artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,49 @@
|
||||
# STATUS — Phase `lex`
|
||||
|
||||
## DONE
|
||||
|
||||
All gates D1–D4: PASS (Adversary-verified @2026-06-15T03:52Z, commit c974829).
|
||||
Note: Adversary F1 (non-blocking) — malformed floats like `".."` leak ValueError; not in DoD scope.
|
||||
|
||||
## Current State
|
||||
Gates D1–D4: CLAIMED, awaiting Adversary verification.
|
||||
|
||||
## Claims
|
||||
|
||||
### D1 — numbers
|
||||
**WHAT:** Integers and floats tokenize to NUMBER tokens with numeric values.
|
||||
**HOW:** Run `python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('42')])"` — expected `[('NUMBER', 42), ('EOF', None)]`. Also `.5` → float 0.5, `10.` → float 10.0, `3.14` → float 3.14.
|
||||
**EXPECTED:** `[('NUMBER', 42), ('EOF', None)]`
|
||||
**WHERE:** `calc/lexer.py`, `calc/test_lexer.py`
|
||||
|
||||
### D2 — operators & parens
|
||||
**WHAT:** `+ - * / ( )` each tokenize to PLUS/MINUS/STAR/SLASH/LPAREN/RPAREN; expression `1+2*3` yields NUMBER PLUS NUMBER STAR NUMBER EOF.
|
||||
**HOW:** `python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize('1+2*3')])"`
|
||||
**EXPECTED:** `['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF']`
|
||||
**WHERE:** `calc/lexer.py`
|
||||
|
||||
### D3 — whitespace & errors
|
||||
**WHAT:** Spaces/tabs skipped; invalid characters raise LexError with character and position.
|
||||
**HOW:**
|
||||
- `python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize(' 12 + 3 ')])"` → `['NUMBER', 'PLUS', 'NUMBER', 'EOF']`
|
||||
- `python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"` → raises `LexError: unexpected character '@' at position 2`
|
||||
**EXPECTED:** whitespace omitted from output; LexError raised with `@` and `2` in message
|
||||
**WHERE:** `calc/lexer.py`
|
||||
|
||||
### D4 — tests green
|
||||
**WHAT:** `calc/test_lexer.py` passes `python -m unittest -q` with 0 failures (14 tests).
|
||||
**HOW:** `python -m unittest -q` from repo root
|
||||
**EXPECTED:** `Ran 14 tests in 0.000s\nOK`
|
||||
**WHERE:** `calc/test_lexer.py`
|
||||
|
||||
## Verification commands (exact, from repo root)
|
||||
```bash
|
||||
python -m unittest -q
|
||||
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])"
|
||||
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
|
||||
```
|
||||
|
||||
Expected outputs:
|
||||
1. `Ran 14 tests in 0.000s` / `OK`
|
||||
2. `[('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]`
|
||||
3. `LexError: unexpected character '@' at position 2`
|
||||
Reference in New Issue
Block a user