artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,63 @@
|
||||
# REVIEW — Phase `parse`
|
||||
|
||||
Adversary: cold-verification log. One entry per gate per pass.
|
||||
|
||||
## Verdicts
|
||||
|
||||
### parse/D1: PASS @2026-06-15T04:03Z
|
||||
Cold-ran at commit e9a5152.
|
||||
```
|
||||
parse(tokenize('1+2*3')) → BinOp('+', Num(1), BinOp('*', Num(2), Num(3))) ✓
|
||||
```
|
||||
`*` binds tighter than `+` — tree structure matches plan requirement. Independently verified extra cases:
|
||||
`1*2+3*4` → `BinOp('+', BinOp('*', Num(1), Num(2)), BinOp('*', Num(3), Num(4)))` ✓
|
||||
|
||||
### parse/D2: PASS @2026-06-15T04:03Z
|
||||
```
|
||||
parse(tokenize('8-3-2')) → BinOp('-', BinOp('-', Num(8), Num(3)), Num(2)) ✓
|
||||
parse(tokenize('8/4/2')) → BinOp('/', BinOp('/', Num(8), Num(4)), Num(2)) ✓
|
||||
```
|
||||
Left-associativity confirmed by `while` loop in `_expr`/`_term` (re-read code). Extra probe:
|
||||
`1+2+3+4` → `BinOp('+', BinOp('+', BinOp('+', Num(1), Num(2)), Num(3)), Num(4))` ✓
|
||||
|
||||
### parse/D3: PASS @2026-06-15T04:03Z
|
||||
```
|
||||
parse(tokenize('(1+2)*3')) → BinOp('*', BinOp('+', Num(1), Num(2)), Num(3)) ✓
|
||||
```
|
||||
Double paren `((3))` → `Num(3)` ✓
|
||||
|
||||
### parse/D4: PASS @2026-06-15T04:03Z
|
||||
```
|
||||
parse(tokenize('-5')) → Unary('-', Num(5)) ✓
|
||||
parse(tokenize('-(1+2)')) → Unary('-', BinOp('+', Num(1), Num(2))) ✓
|
||||
parse(tokenize('3 * -2')) → BinOp('*', Num(3), Unary('-', Num(2))) ✓
|
||||
```
|
||||
Extra probes: `--5` → `Unary('-', Unary('-', Num(5)))` ✓; `1+-2` → `BinOp('+', Num(1), Unary('-', Num(2)))` ✓;
|
||||
`-1-2` → `BinOp('-', Unary('-', Num(1)), Num(2))` ✓; `-(-(1))` → `Unary('-', Unary('-', Num(1)))` ✓
|
||||
|
||||
### parse/D5: PASS @2026-06-15T04:03Z
|
||||
All five plan-mandated malformed inputs raise `ParseError` (not TypeError/ValueError/IndexError):
|
||||
```
|
||||
'1 +' → ParseError: unexpected end of input ✓
|
||||
'(1' → ParseError: expected RPAREN, got 'EOF' (None) ✓
|
||||
'1 2' → ParseError: unexpected token 'NUMBER' (2) ✓
|
||||
')(' → ParseError: unexpected token 'RPAREN' (')') ✓
|
||||
'' → ParseError: unexpected end of input ✓
|
||||
```
|
||||
Extra probes all raise ParseError: `* 1`, `1 * `, `()`, `1 + ()`, `1)`, `(1+2` — all correct.
|
||||
|
||||
### parse/D6: PASS @2026-06-15T04:03Z
|
||||
```
|
||||
$ python -m unittest -q
|
||||
Ran 34 tests in 0.001s
|
||||
OK
|
||||
```
|
||||
34 tests (14 lex + 20 parse), 0 failures.
|
||||
|
||||
## Adversary findings
|
||||
|
||||
_(none — no defects found; no veto)_
|
||||
|
||||
## Summary
|
||||
|
||||
All six DoD gates PASS. No veto. Builder may write "## DONE" to STATUS-parse.md.
|
||||
Reference in New Issue
Block a user