artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,44 @@
|
||||
# REVIEW — Phase `parse` (Adversary)
|
||||
|
||||
## Status
|
||||
All gates D1–D6: PASS. Phase complete — no defects found.
|
||||
|
||||
## Gate verdicts
|
||||
|
||||
### D1 — Precedence: PASS @2026-06-15T04:08Z
|
||||
Cold run: `parse(tokenize('1+2*3'))` → `BinOp('+', Num(1), BinOp('*', Num(2), Num(3)))` ✓
|
||||
Matches expected. Also verified `2*3+1`, `10-4/2`, `1+2*3-4/2` all produce correct precedence trees.
|
||||
|
||||
### D2 — Left Associativity: PASS @2026-06-15T04:08Z
|
||||
Cold run:
|
||||
- `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))` ✓
|
||||
Also verified `1+2+3` and `2*3*4` fold left correctly.
|
||||
|
||||
### D3 — Parentheses: PASS @2026-06-15T04:08Z
|
||||
Cold run: `parse(tokenize('(1+2)*3'))` → `BinOp('*', BinOp('+', Num(1), Num(2)), Num(3))` ✓
|
||||
Also verified nested parens `((2+3))`, `8-(3-2)`, and `(42)`.
|
||||
|
||||
### D4 — Unary Minus: PASS @2026-06-15T04:08Z
|
||||
Cold run:
|
||||
- `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)))` ✓
|
||||
Also verified `--5` → `Unary('-', Unary('-', Num(5)))` and `1 + -(2 * 3)`.
|
||||
|
||||
### D5 — Errors: PASS @2026-06-15T04:08Z
|
||||
All five plan-specified malformed inputs raise `ParseError` (not any other exception):
|
||||
- `"1 +"` → ParseError: unexpected token 'EOF' ✓
|
||||
- `"(1"` → ParseError: expected RPAREN, got 'EOF' ✓
|
||||
- `"1 2"` → ParseError: unexpected token 'NUMBER' ✓
|
||||
- `")("` → ParseError: unexpected token 'RPAREN' ✓
|
||||
- `""` → ParseError: empty input ✓
|
||||
Extra adversarial cases also raise ParseError: `*5`, `/5`, `()`, `1++2`, `*` alone.
|
||||
|
||||
### D6 — Tests Green: PASS @2026-06-15T04:08Z
|
||||
`python -m unittest -q` → `Ran 44 tests in 0.001s OK` ✓
|
||||
23 parser tests (TestPrecedence×4, TestLeftAssociativity×4, TestParentheses×4, TestUnaryMinus×5, TestErrors×6) + 21 lexer tests.
|
||||
All assertions are structural (equality via `__eq__` on `Num`/`BinOp`/`Unary` nodes), not evaluation.
|
||||
|
||||
## Adversary findings
|
||||
None. No defects found.
|
||||
Reference in New Issue
Block a user