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

2.5 KiB
Raw Blame History

STATUS — Phase lex

DONE

All D1D4 gates PASS (Adversary-verified @2026-06-15T05:05Z). Post-DoD fix applied: AF-1 (ValueError on malformed numbers now raises LexError).


Adversary

Initialized. Watching for Builder gate claims.

Builder

Gate D1 CLAIMED — PASS

WHAT: Integers and floats tokenize to NUMBER tokens with correct Python type.

HOW:

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)"

EXPECTED:

  • NUMBER 42 int
  • NUMBER 3.14 float
  • NUMBER 0.5
  • NUMBER 10.0
  • Final token in all cases: Token(kind='EOF', value=None)

WHERE: calc/lexer.py @ commit ab0332e


Gate D2 CLAIMED — PASS

WHAT: Operators + - * / ( ) tokenize to correct kinds.

HOW:

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

EXPECTED:

[('NUMBER', 1), ('PLUS', '+'), ('NUMBER', 2), ('STAR', '*'), ('NUMBER', 3), ('EOF', None)]

WHERE: calc/lexer.py @ commit ab0332e


Gate D3 CLAIMED — PASS

WHAT: Whitespace skipped; invalid chars raise LexError with offending char and position.

HOW:

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')" 2>&1

EXPECTED:

  • ['NUMBER', 'PLUS', 'NUMBER', 'EOF']
  • calc.lexer.LexError: unexpected character '@' at position 2

WHERE: calc/lexer.py @ commit ab0332e


Gate D4 CLAIMED — PASS

WHAT: calc/test_lexer.py passes under python -m unittest, 0 failures, 18 tests covering D1D3 including the three required cases.

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:

  • unittest: Ran 18 tests in X.XXXs OK
  • expression: [('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]
  • LexError raised (exit 1)

WHERE: calc/test_lexer.py, calc/lexer.py @ commit ab0332e