Files
agent-orchestrator-benchmark/calculators/builder-solo/run-04/machine-docs/JOURNAL-lex.md

745 B

JOURNAL-lex

2026-06-15

Built: calc/__init__.py, calc/lexer.py, calc/test_lexer.py, .gitignore

Design decisions:

  • Token is a @dataclass with kind: str and value: Union[int, float, str, None]
  • Operators/parens carry their char as value; EOF carries None
  • Number parsing: scans contiguous digits/dots; if . present → float(), else int()
  • LexError extends Exception; message includes repr of bad char and its index

Verification (all 3 plan commands passed):

  1. python -m unittest -q → 15 tests, 0 failures
  2. tokenize('3.5*(1-2)') → correct 8-token list
  3. tokenize('1 @ 2') → raises LexError: unexpected character '@' at position 2

Commit: c37b70f — pushed to origin/main