artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
# Adversary Review — parse phase
|
||||
|
||||
Verified cold at commit d97df78.
|
||||
|
||||
## Verdicts
|
||||
|
||||
| Gate | Verdict | Timestamp |
|
||||
|------|---------|-----------|
|
||||
| D1 | PASS | 2026-06-15T03:28Z |
|
||||
| D2 | PASS | 2026-06-15T03:28Z |
|
||||
| D3 | PASS | 2026-06-15T03:28Z |
|
||||
| D4 | PASS | 2026-06-15T03:28Z |
|
||||
| D5 | PASS | 2026-06-15T03:28Z |
|
||||
| D6 | PASS | 2026-06-15T03:28Z |
|
||||
|
||||
## Evidence
|
||||
|
||||
**D6 — test suite:** `python -m unittest -q` → Ran 34 tests in 0.001s OK
|
||||
|
||||
**D1 — precedence:** `parse(tokenize('1+2*3'))` → `BinOp('+', Num(1), BinOp('*', Num(2), Num(3)))` ✓
|
||||
`*` is in the right subtree, proving it binds tighter than `+`.
|
||||
|
||||
**D2 — left associativity:**
|
||||
- `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))` ✓
|
||||
|
||||
**D3 — parentheses:** `parse(tokenize('(1+2)*3'))` → `BinOp('*', BinOp('+', Num(1), Num(2)), Num(3))` ✓
|
||||
|
||||
**D4 — unary minus:**
|
||||
- `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)))` ✓
|
||||
|
||||
**D5 — ParseError for all 5 plan-specified malformed inputs:**
|
||||
- `'1 +'` → `ParseError: unexpected token 'EOF' (None)` ✓
|
||||
- `'(1'` → `ParseError: expected ')' but got 'EOF'` ✓
|
||||
- `'1 2'` → `ParseError: unexpected token 'NUMBER' (2) after expression` ✓
|
||||
- `')('` → `ParseError: unexpected token 'RPAREN' (')')` ✓
|
||||
- `''` → `ParseError: empty input` ✓
|
||||
|
||||
**Adversarial extras (not in plan, all pass):**
|
||||
- `'--5'` → `Unary('-', Unary('-', Num(5)))` (recursive unary) ✓
|
||||
- `'2+3*4-1'` → correct mixed-precedence left-assoc tree ✓
|
||||
- `'-3*-2'` → `BinOp('*', Unary('-', Num(3)), Unary('-', Num(2)))` ✓
|
||||
- `'*5'` → `ParseError` (bare leading operator) ✓
|
||||
Reference in New Issue
Block a user