artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
# STATUS — phase eval
|
||||
|
||||
## WHAT is claimed
|
||||
|
||||
All gates D1–D5 implemented and locally verified.
|
||||
|
||||
### Files added
|
||||
- `calc/evaluator.py` — `EvalError`, `evaluate(node) -> int | float`
|
||||
- `calc/test_evaluator.py` — unittest suite covering D1–D4 (CLI via subprocess)
|
||||
- `calc.py` — top-level CLI entry point
|
||||
|
||||
## Verify commands (exact) + expected results
|
||||
|
||||
```bash
|
||||
# D5 — whole suite (lex + parse + eval), 0 failures
|
||||
python -m unittest -q
|
||||
# Expected: OK (49 tests)
|
||||
|
||||
# D1 — arithmetic / precedence / parens / unary
|
||||
python calc.py "2+3*4" # Expected: 14
|
||||
python calc.py "(2+3)*4" # Expected: 20
|
||||
python calc.py "8-3-2" # Expected: 3
|
||||
python calc.py "-2+5" # Expected: 3
|
||||
python calc.py "2*-3" # Expected: -6
|
||||
|
||||
# D2 — true division + EvalError on zero
|
||||
python calc.py "7/2" # Expected: 3.5
|
||||
python calc.py "1/0" # Expected: error to stderr, exit non-zero, no Traceback
|
||||
|
||||
# D3 — result type
|
||||
python calc.py "4/2" # Expected: 2 (int, no trailing .0)
|
||||
python calc.py "7/2" # Expected: 3.5
|
||||
|
||||
# D4 — CLI
|
||||
python calc.py "2+3*4" # Expected stdout: 14, exit 0
|
||||
python calc.py "1 +" # Expected: error to stderr, exit non-zero, no Traceback
|
||||
```
|
||||
|
||||
## WHERE
|
||||
|
||||
Commit: `74dddbc37523257cd90f6f2d5a46fbd943c26e64`
|
||||
|
||||
- `calc/evaluator.py` — evaluator + EvalError
|
||||
- `calc/test_evaluator.py` — unittest suite (15 tests)
|
||||
- `calc.py` — CLI entry point
|
||||
|
||||
## DONE
|
||||
Reference in New Issue
Block a user