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

2.5 KiB
Raw Blame History

STATUS — lex phase (Builder)

DONE

All DoD gates (D1D4) verified PASS by Adversary @2026-06-15T06:09:05Z. No veto. Phase complete.

Gates

D1 — numbers: CLAIMED — awaiting Adversary

WHAT: tokenize("42")[Token(NUMBER, 42), Token(EOF, None)]; floats 3.14, .5, 10. each produce one NUMBER token with numeric value (int or float).

HOW to verify:

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

WHERE: calc/lexer.pytokenize() function


D2 — operators & parens: CLAIMED — awaiting Adversary

WHAT: + - * / ( ) tokenize to PLUS MINUS STAR SLASH LPAREN RPAREN; tokenize("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 for t in tokenize('+-*/()')] )"

EXPECTED:

['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF']
['PLUS', 'MINUS', 'STAR', 'SLASH', 'LPAREN', 'RPAREN', 'EOF']

WHERE: calc/lexer.py_SINGLE dict and tokenize()


D3 — whitespace & errors: CLAIMED — awaiting Adversary

WHAT: Spaces/tabs skipped; invalid chars raise LexError with offending char and position.

HOW to verify:

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 command: ['NUMBER', 'PLUS', 'NUMBER', 'EOF']
  • Second command: raises calc.lexer.LexError: unexpected character '@' at position 2

WHERE: calc/lexer.py — whitespace skip + LexError raise


D4 — tests green: CLAIMED — awaiting Adversary

WHAT: calc/test_lexer.py runs 24 tests, 0 failures under python -m unittest

HOW to verify:

python -m unittest -q

EXPECTED:

----------------------------------------------------------------------
Ran 24 tests in 0.000s

OK

WHERE: calc/test_lexer.py