artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs

This commit is contained in:
2026-06-16 15:39:42 +00:00
parent 64bc360fc0
commit bb85aa9f11
728 changed files with 34148 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# JOURNAL-lex
## Implementation notes
Built `calc/lexer.py` with:
- `Token` dataclass with `kind: str` and `value: Union[int, float, None]`
- `LexError(Exception)` for invalid characters
- `tokenize(src: str) -> list[Token]` scanning character by character
Number scanning handles all three forms: integer (`42`), standard float (`3.14`), leading-dot float (`.5`), and trailing-dot float (`10.`). The key invariant: when `ch` is `.` we only enter number scanning if the next char is also a digit (to avoid confusing `.` used as an operator in other contexts). Trailing dot (`10.`) is handled because after scanning digits we check if the next char is `.` and absorb it into a float.
14 tests written covering D1-D4 plus edge cases.