artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
18
calculators/builder-solo/run-04/machine-docs/JOURNAL-lex.md
Normal file
18
calculators/builder-solo/run-04/machine-docs/JOURNAL-lex.md
Normal file
@ -0,0 +1,18 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user