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

3.2 KiB

STATUS-lex.md

DONE

All DoD gates Adversary-verified PASS. Phase lex complete.

  • D1: PASS @2026-06-15T04:34:35Z
  • D2: PASS @2026-06-15T04:34:35Z
  • D3: PASS @2026-06-15T04:40:18Z (AF-1 fixed: bare . now raises LexError)
  • D4: PASS @2026-06-15T04:40:18Z (21 tests, 0 failures)

Fix commit: f40a364


Gate D1 — Numbers CLAIMED

WHAT: tokenize() converts integers and floats to NUMBER tokens with numeric values.

HOW to verify:

python -c "from calc.lexer import tokenize; r=tokenize('42'); print(r[0].kind, r[0].value, type(r[0].value).__name__)"
python -c "from calc.lexer import tokenize; r=tokenize('3.14'); print(r[0].kind, r[0].value, type(r[0].value).__name__)"
python -c "from calc.lexer import tokenize; r=tokenize('.5'); print(r[0].kind, r[0].value)"
python -c "from calc.lexer import tokenize; r=tokenize('10.'); print(r[0].kind, r[0].value, type(r[0].value).__name__)"
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('42')])"

EXPECTED:

  • NUMBER 42 int
  • NUMBER 3.14 float
  • NUMBER 0.5
  • NUMBER 10.0 float
  • [('NUMBER', 42), ('EOF', None)]

WHERE: calc/lexer.py, commit fb03159


Gate D2 — Operators & Parens CLAIMED

WHAT: + - * / ( ) tokenize to correct kinds; "1+2*3" → NUMBER PLUS NUMBER STAR NUMBER EOF.

HOW to verify:

python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize('1+2*3')])"
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('+-*/()')] )"

EXPECTED:

  • ['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF']
  • [('PLUS', '+'), ('MINUS', '-'), ('STAR', '*'), ('SLASH', '/'), ('LPAREN', '('), ('RPAREN', ')'), ('EOF', None)]

WHERE: calc/lexer.py, commit fb03159


Gate D3 — Whitespace & Errors RE-CLAIMED (AF-1 fixed)

WHAT: Spaces/tabs skipped; ALL invalid inputs raise LexError (including bare .).

Fix applied: Wrapped float(raw) / int(raw) conversion in try/except; raises LexError on bad numeric literals. Added test_bare_dot_raises_lex_error to test suite.

HOW to verify:

python -m unittest -q
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')"
python -c "from calc.lexer import tokenize; tokenize('.')"

EXPECTED:

  • Ran 21 tests in 0.000s\nOK
  • ['NUMBER', 'PLUS', 'NUMBER', 'EOF']
  • Raises calc.lexer.LexError: unexpected character '@' at position 2
  • Raises calc.lexer.LexError: invalid number literal '.' at position 0

WHERE: calc/lexer.py, calc/test_lexer.py (see fix commit)


Gate D4 — Tests Green CLAIMED

WHAT: calc/test_lexer.py passes under python -m unittest with 0 failures.

HOW to verify:

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:

  • Ran 20 tests in 0.000s\nOK
  • [('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]
  • Raises LexError

WHERE: calc/test_lexer.py, commit fb03159