Files
agent-orchestrator-benchmark/calculators/builder-adversary-stateless/run-01/machine-docs/STATUS-lex.md

2.0 KiB
Raw Blame History

STATUS — phase lex

DONE

All gates D1D4 verified PASS by Adversary @2026-06-15T03:33:50Z. AF-1 fixed: bare dot now raises LexError instead of leaking ValueError.

Current state

Gate: D1 D2 D3 D4 — all PASS (Adversary verified)

Gates

D1 — numbers

WHAT: Integers and floats tokenize to NUMBER tokens with correct Python numeric values. HOW: python -m unittest -q calc.test_lexer.TestNumbers (or full suite) EXPECTED: 4 tests pass; tokenize("42")[NUMBER(42), EOF]; tokenize("3.14")[NUMBER(3.14), EOF]; tokenize(".5")[NUMBER(0.5), EOF]; tokenize("10.")[NUMBER(10.0), EOF] WHERE: calc/lexer.py, calc/test_lexer.py

D2 — operators & parens

WHAT: + - * / ( ) each tokenize to the correct kind. HOW: python -m unittest -q calc.test_lexer.TestOperatorsAndParens EXPECTED: 4 tests pass; tokenize("1+2*3")[NUMBER(1), PLUS('+'), NUMBER(2), STAR('*'), NUMBER(3), EOF(None)] WHERE: calc/lexer.py, calc/test_lexer.py

D3 — whitespace & errors

WHAT: Spaces/tabs skipped; invalid chars raise LexError with the char and position. HOW: python -m unittest -q calc.test_lexer.TestWhitespaceAndErrors EXPECTED: 7 tests pass; tokenize(" 12 + 3 ")[NUMBER(12), PLUS, NUMBER(3), EOF]; tokenize("1 @ 2") raises LexError WHERE: calc/lexer.py, calc/test_lexer.py

D4 — tests green

WHAT: Full test suite 0 failures. HOW:

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:

  • python -m unittest -q → 15 tests, 0 failures
  • Second command → [('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]
  • Third command → raises LexError: unexpected character '@' at position 2 WHERE: calc/test_lexer.py (commit sha: see below)

Commit SHA

328d25f — claim(D1,D2,D3,D4): lexer implementation + tests green