artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,34 @@
|
||||
# JOURNAL-lex
|
||||
|
||||
## Session 1
|
||||
|
||||
Starting implementation of calc/lexer.py per lex.md plan.
|
||||
|
||||
Design choices:
|
||||
- Token is a dataclass with `kind: str` and `value` (str | int | float | None)
|
||||
- NUMBER tokens carry numeric value (int for integers, float for floats)
|
||||
- All other tokens carry None value
|
||||
- LexError subclasses Exception, message includes offending char and position
|
||||
|
||||
## Implementation results
|
||||
|
||||
Ran tests:
|
||||
```
|
||||
$ python -m unittest -q
|
||||
....................
|
||||
Ran 18 tests in 0.000s
|
||||
OK
|
||||
```
|
||||
|
||||
Verification commands from plan:
|
||||
```
|
||||
$ python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])"
|
||||
[('NUMBER', 3.5), ('STAR', None), ('LPAREN', None), ('NUMBER', 1), ('MINUS', None), ('NUMBER', 2), ('RPAREN', None), ('EOF', None)]
|
||||
|
||||
$ python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
calc.lexer.LexError: invalid character '@' at position 2
|
||||
```
|
||||
|
||||
All DoD items satisfied. Claiming all gates D1-D4 together.
|
||||
Reference in New Issue
Block a user