Files
agent-orchestrator-benchmark/calculators/builder-adversary-stateless/run-04/machine-docs/REVIEW-parse.md

2.6 KiB
Raw Blame History

REVIEW — phase parse

Adversary cold-verification log. Each gate: PASS or FAIL with evidence.


D1: PASS @2026-06-15T04:22:33Z

Cold-run: python -c "from calc.lexer import tokenize; from calc.parser import parse; print(parse(tokenize('1+2*3')))"

Output: BinOp('PLUS', Num(1), BinOp('STAR', Num(2), Num(3))) — matches expected exactly.

Adversarial probe: 2+3*4-1BinOp('MINUS', BinOp('PLUS', Num(2), BinOp('STAR', Num(3), Num(4))), Num(1)) — correct.


D2: PASS @2026-06-15T04:22:33Z

Cold-run:

  • 8-3-2BinOp('MINUS', BinOp('MINUS', Num(8), Num(3)), Num(2))
  • 8/4/2BinOp('SLASH', BinOp('SLASH', Num(8), Num(4)), Num(2))

Both match expected. Left-fold while loops in expr() and term() confirmed correct.


D3: PASS @2026-06-15T04:22:33Z

Cold-run: (1+2)*3BinOp('STAR', BinOp('PLUS', Num(1), Num(2)), Num(3)) — matches expected.

Adversarial probe: ((5))Num(5) ✓. () raises ParseError ✓.


D4: PASS @2026-06-15T04:22:33Z

Cold-runs:

  • -5Unary('MINUS', Num(5))
  • -(1+2)Unary('MINUS', BinOp('PLUS', Num(1), Num(2)))
  • 3 * -2BinOp('STAR', Num(3), Unary('MINUS', Num(2)))

Adversarial probes:

  • --5Unary('MINUS', Unary('MINUS', Num(5))) ✓ (recursive unary works)
  • -(-(3))Unary('MINUS', Unary('MINUS', Num(3)))
  • 1 + -2 * -3BinOp('PLUS', Num(1), BinOp('STAR', Unary('MINUS', Num(2)), Unary('MINUS', Num(3))))

D5: PASS @2026-06-15T04:22:33Z

All 5 cases raise ParseError (not any other exception type):

  • '1 +'ParseError: unexpected token 'EOF'
  • '(1'ParseError: expected ')', got 'EOF'
  • '1 2'ParseError: unexpected token 'NUMBER' after expression
  • ')('ParseError: unexpected token 'RPAREN'
  • ''ParseError: unexpected token 'EOF'

Adversarial probes:

  • +5ParseError: unexpected token 'PLUS' ✓ (no unary plus — correct)
  • 1+2 3+4ParseError: unexpected token 'NUMBER' after expression

D6: PASS @2026-06-15T04:22:33Z

Cold-run: python -m unittest -q

Ran 39 tests in 0.001s
OK

39 tests, 0 failures, 0 errors. ✓


Observation (non-blocking)

STATUS claims "frozen @dataclasss" but nodes use bare @dataclass without frozen=True — they are mutable. Verified: n = Num(5); n.value = 99 succeeds. This is not a DoD failure (the plan says "Represent nodes however you like"), but the evaluator should be aware nodes are mutable.


Summary

All gates D1D6: PASS. No vetoes. No defects blocking DONE.