artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,53 @@
|
||||
# REVIEW — phase parse
|
||||
|
||||
## D1: PASS @2026-06-15T02:27:10Z
|
||||
|
||||
Cold run: `parse(tokenize('1+2*3'))` → `BinOp('+', Num(1), BinOp('*', Num(2), Num(3)))`
|
||||
Structure assertion passed. `*`/`/` correctly bind tighter than `+`/`-`.
|
||||
Also verified: `6/2+1` → `BinOp('+', BinOp('/', Num(6), Num(2)), Num(1))` (div-then-add order correct).
|
||||
Multi-level: `1+2*3+4` → `BinOp('+', BinOp('+', Num(1), BinOp('*', Num(2), Num(3))), Num(4))` ✓
|
||||
|
||||
## D2: PASS @2026-06-15T02:27:10Z
|
||||
|
||||
Cold run:
|
||||
- `8-3-2` → `BinOp('-', BinOp('-', Num(8), Num(3)), Num(2))` ✓
|
||||
- `8/4/2` → `BinOp('/', BinOp('/', Num(8), Num(4)), Num(2))` ✓
|
||||
|
||||
Left associativity correct for both addition and division via the while-loop in `_expr`/`_term`.
|
||||
|
||||
## D3: PASS @2026-06-15T02:27:10Z
|
||||
|
||||
Cold run: `(1+2)*3` → `BinOp('*', BinOp('+', Num(1), Num(2)), Num(3))` ✓
|
||||
Also verified: `((5))` → `Num(5)`, `2*(3+4)` → `BinOp('*', Num(2), BinOp('+', Num(3), Num(4)))` ✓
|
||||
|
||||
## D4: PASS @2026-06-15T02:27:10Z
|
||||
|
||||
Cold run:
|
||||
- `-5` → `Unary('-', Num(5))` ✓
|
||||
- `-(1+2)` → `Unary('-', BinOp('+', Num(1), Num(2)))` ✓
|
||||
- `3 * -2` → `BinOp('*', Num(3), Unary('-', Num(2)))` ✓
|
||||
- `--5` → `Unary('-', Unary('-', Num(5)))` ✓ (recursive _unary handles chaining)
|
||||
|
||||
## D5: PASS @2026-06-15T02:27:10Z
|
||||
|
||||
All five mandated error inputs raise `ParseError` (not any other exception):
|
||||
- `'1 +'` → ParseError: unexpected token 'EOF' ✓
|
||||
- `'(1'` → ParseError: expected ')', got 'EOF' ✓
|
||||
- `'1 2'` → ParseError: unexpected token 'NUMBER' ✓
|
||||
- `')('` → ParseError: unexpected token 'RPAREN' ✓
|
||||
- `''` → ParseError: empty input ✓
|
||||
|
||||
Adversarial: `+5` (unary plus) correctly raises ParseError (not in grammar, no crash) ✓
|
||||
|
||||
## D6: PASS @2026-06-15T02:27:10Z
|
||||
|
||||
```
|
||||
Ran 36 tests in 0.001s
|
||||
OK
|
||||
```
|
||||
|
||||
36 tests, 0 failures. Suite covers D1–D5 with structure-level assertions (not evaluation).
|
||||
|
||||
---
|
||||
|
||||
Adversary verdict: all gates D1–D6 independently verified cold. Implementation is correct.
|
||||
Reference in New Issue
Block a user