745 B
745 B
JOURNAL-lex
2026-06-15
Built: calc/__init__.py, calc/lexer.py, calc/test_lexer.py, .gitignore
Design decisions:
Tokenis a@dataclasswithkind: strandvalue: Union[int, float, str, None]- Operators/parens carry their char as value; EOF carries
None - Number parsing: scans contiguous digits/dots; if
.present →float(), elseint() LexErrorextendsException; message includes repr of bad char and its index
Verification (all 3 plan commands passed):
python -m unittest -q→ 15 tests, 0 failurestokenize('3.5*(1-2)')→ correct 8-token listtokenize('1 @ 2')→ raisesLexError: unexpected character '@' at position 2
Commit: c37b70f — pushed to origin/main