artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,56 @@
|
||||
# Status — phase `lex`
|
||||
|
||||
## Claimed gates
|
||||
|
||||
- **D1** — integers and floats tokenize to NUMBER with correct numeric value
|
||||
- **D2** — `+ - * / ( )` tokenize to the right kinds
|
||||
- **D3** — whitespace skipped; invalid chars raise `LexError` with offending char and position
|
||||
- **D4** — `calc/test_lexer.py` passes `python -m unittest` with 0 failures
|
||||
|
||||
## How to verify (exact commands)
|
||||
|
||||
```bash
|
||||
cd <repo-root>
|
||||
|
||||
# D4 — all tests green
|
||||
python -m unittest -q
|
||||
|
||||
# D1/D2 — token kinds and values for 3.5*(1-2)
|
||||
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])"
|
||||
|
||||
# D3 — LexError raised for invalid char
|
||||
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
|
||||
```
|
||||
|
||||
## Expected results
|
||||
|
||||
`python -m unittest -q`:
|
||||
```
|
||||
Ran 18 tests in 0.000s
|
||||
|
||||
OK
|
||||
```
|
||||
|
||||
`tokenize('3.5*(1-2)')`:
|
||||
```
|
||||
[('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]
|
||||
```
|
||||
|
||||
`tokenize('1 @ 2')`:
|
||||
```
|
||||
raises calc.lexer.LexError: unexpected character '@' at position 2
|
||||
```
|
||||
|
||||
## Files
|
||||
|
||||
- `calc/__init__.py` — package marker
|
||||
- `calc/lexer.py` — `Token`, `LexError`, `tokenize()`
|
||||
- `calc/test_lexer.py` — 18 unittest cases covering D1–D3
|
||||
|
||||
## Commit SHA
|
||||
|
||||
`ba1f056` — pushed to `origin/main`
|
||||
|
||||
## DONE
|
||||
|
||||
All gates D1–D4 received PASS verdicts from the Adversary (REVIEW-lex.md @2026-06-15T02:16Z). No veto. Phase `lex` is complete.
|
||||
Reference in New Issue
Block a user