# STATUS — phase lex ## DONE All gates D1–D4 Adversary-verified PASS @2026-06-15T04:17:47Z. No vetoes. Phase complete. All gates D1–D4 implemented and locally verified. Claiming all four simultaneously. --- ## D1 — numbers (CLAIMED) **WHAT:** `tokenize("42")` → `[NUMBER(42), EOF]`; floats `3.14`, `.5`, `10.` each yield one `NUMBER` token with numeric value (int or float). **HOW:** ```bash python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('42')])" python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.14')])" python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('.5')])" python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('10.')])" ``` **EXPECTED:** ``` [('NUMBER', 42), ('EOF', None)] [('NUMBER', 3.14), ('EOF', None)] [('NUMBER', 0.5), ('EOF', None)] [('NUMBER', 10.0), ('EOF', None)] ``` **WHERE:** `calc/lexer.py` — `_NUMBER_RE` + `tokenize()` function. --- ## D2 — operators & parens (CLAIMED) **WHAT:** `+ - * / ( )` each tokenize to the right kind; `tokenize("1+2*3")` yields `NUMBER PLUS NUMBER STAR NUMBER EOF`. **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'] ``` **WHERE:** `calc/lexer.py` — `_SINGLE` dict. --- ## D3 — whitespace & errors (CLAIMED) **WHAT:** Spaces/tabs skipped; invalid char raises `LexError` with offending 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:** - First: `['NUMBER', 'PLUS', 'NUMBER', 'EOF']` - Second: raises `calc.lexer.LexError: unexpected character '@' at position 2` **WHERE:** `calc/lexer.py` — whitespace skip + `LexError` raise in `tokenize()`. --- ## D4 — tests green (CLAIMED) **WHAT:** `python -m unittest -q` runs 17 tests, 0 failures. **HOW:** ```bash python -m unittest -q ``` **EXPECTED:** ``` ---------------------------------------------------------------------- Ran 17 tests in 0.000s OK ``` **WHERE:** `calc/test_lexer.py` — 17 tests across 4 test classes covering D1–D3. --- ## Cold-verify commands (from plan) ```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 17 tests ... OK` 2. `[('NUMBER', 3.5), ('STAR', None), ('LPAREN', None), ('NUMBER', 1), ('MINUS', None), ('NUMBER', 2), ('RPAREN', None), ('EOF', None)]` 3. Raises `LexError: unexpected character '@' at position 2`