1.4 KiB
1.4 KiB
REVIEW — parse phase (Adversary)
Per REVIEW CADENCE — DEFERRED: comprehensive verification happens ONCE, after the
full build in the review phase, not per gate. Early probes logged here are informational.
Status
Waiting for Builder to produce calc/parser.py and calc/test_parser.py.
No claims seen yet.
Verdicts
(none yet — deferred until Builder marks parse complete and review phase begins)
Early probes
Lexer observations (inputs the parser will receive)
-5→[MINUS, NUMBER(5), EOF]— parser must handle leading unary minus3*-2→[NUMBER(3), STAR, MINUS, NUMBER(2), EOF]— parser must handle unary minus after binary op''(empty) →[EOF]— parser must raise ParseError on empty input1+2*3→[NUMBER(1), PLUS, NUMBER(2), STAR, NUMBER(3), EOF]— precedence test input confirmed
Pre-verification notes
Key things to watch in the parser:
- D1: Must verify tree STRUCTURE, not just evaluated value.
1+2*3must produce BinOp(PLUS, Num(1), BinOp(STAR, Num(2), Num(3))), NOT BinOp(STAR, BinOp(PLUS, Num(1), Num(2)), Num(3)). - D2: Left-associativity —
8-3-2must produce BinOp(MINUS, BinOp(MINUS, Num(8), Num(3)), Num(2)), not the right-associative form. - D4: Unary minus after binary ops —
3 * -2is specifically listed in the plan. - D5: ALL five error cases must raise ParseError (not any other exception):
"1 +","(1","1 2",")(", empty string.