# STATUS — Phase lex (Builder) ## DONE All gates D1, D2, D3, D4 verified PASS by Adversary @2026-06-15T06:26:41Z. AF-1 fixed: bare `.` now raises `LexError` instead of leaking `ValueError`. ## Current State All implementation complete. All gates PASSED. --- ## Gate D1 — numbers — CLAIMED, awaiting Adversary **WHAT:** `calc/lexer.py` tokenizes integers and floats to NUMBER tokens with numeric values. **HOW:** Run from repo root (where calc/ lives): ```bash python -c "from calc.lexer import tokenize; t=tokenize('42'); print(t[0].kind, t[0].value, type(t[0].value).__name__)" python -c "from calc.lexer import tokenize; t=tokenize('3.14'); print(t[0].kind, t[0].value, type(t[0].value).__name__)" python -c "from calc.lexer import tokenize; t=tokenize('.5'); print(t[0].kind, t[0].value, type(t[0].value).__name__)" python -c "from calc.lexer import tokenize; t=tokenize('10.'); print(t[0].kind, t[0].value, type(t[0].value).__name__)" ``` **EXPECTED:** ``` NUMBER 42 int NUMBER 3.14 float NUMBER 0.5 float NUMBER 10.0 float ``` (Each followed by EOF as second token.) **WHERE:** `calc/lexer.py` — commit to be pushed with this status. --- ## Gate D2 — operators & parens — CLAIMED, awaiting Adversary **WHAT:** `+ - * / ( )` each tokenize to PLUS, MINUS, STAR, SLASH, LPAREN, RPAREN. **HOW:** ```bash python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize('1+2*3')])" ``` **EXPECTED:** ``` ['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF'] ``` --- ## Gate D3 — whitespace & errors — CLAIMED, awaiting Adversary **WHAT:** Spaces/tabs are skipped; invalid chars raise LexError with char and position. **HOW:** ```bash python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize(' 12 + 3 ')])" python -c "from calc.lexer import tokenize; tokenize('1 @ 2')" ``` **EXPECTED:** ``` ['NUMBER', 'PLUS', 'NUMBER', 'EOF'] calc.lexer.LexError: unexpected character '@' at position 2 ``` --- ## Gate D4 — tests green — CLAIMED, awaiting Adversary **WHAT:** `calc/test_lexer.py` passes with 0 failures. **HOW:** ```bash python -m unittest -q ``` **EXPECTED:** ``` Ran 15 tests in 0.00Xs OK ``` Also the plan's exact verification commands: ```bash python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])" ``` **Expected:** ``` [('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', '')] ``` ```bash python -c "from calc.lexer import tokenize; tokenize('1 @ 2')" ``` **Expected:** raises `calc.lexer.LexError: unexpected character '@' at position 2` **WHERE:** `calc/test_lexer.py`, `calc/lexer.py` — see commit sha after push.