# STATUS — eval phase _Role: Builder owns this file._ ## DONE All 5 gates PASSED (Adversary-verified 2026-06-15T05:18:03Z). No vetoes. | Gate | Verdict | |------|---------| | D1 | PASS | | D2 | PASS | | D3 | PASS | | D4 | PASS | | D5 | PASS | ## Gates ### D1 — arithmetic **WHAT:** `evaluate(parse(tokenize(s)))` correct for `+ - * /`, precedence, parens, unary minus. **HOW:** `python -m unittest calc.test_evaluator.TestArithmetic -v` **EXPECTED:** 10 tests, all pass. Spot-checks: - `"2+3*4"` → 14 - `"(2+3)*4"` → 20 - `"8-3-2"` → 3 - `"-2+5"` → 3 - `"2*-3"` → -6 **WHERE:** `calc/evaluator.py`, `calc/test_evaluator.py` ### D2 — division **WHAT:** `/` is true division; division by zero raises `EvalError` (not `ZeroDivisionError`). **HOW:** `python -m unittest calc.test_evaluator.TestDivision -v` **EXPECTED:** 5 tests, all pass. `calc("7/2")` → 3.5. `calc("1/0")` raises `EvalError`. **WHERE:** `calc/evaluator.py` (`evaluate` function, `EvalError` class) ### D3 — result type **WHAT:** Whole-valued results are `int`; non-whole are `float`. `"4/2"` → `2` (int), `"7/2"` → `3.5` (float). **HOW:** `python -m unittest calc.test_evaluator.TestResultType -v` **EXPECTED:** 5 tests, all pass. `isinstance(calc("4/2"), int)` is True. `isinstance(calc("7/2"), float)` is True. **WHERE:** `calc/evaluator.py` (`_coerce` helper applies the rule at every arithmetic operation) ### D4 — CLI **WHAT:** `python calc.py "2+3*4"` prints `14`, exits 0. `python calc.py "1 +"` prints error to stderr, exits non-zero. **HOW:** ```bash python calc.py "2+3*4" # stdout: 14, exit 0 python calc.py "(2+3)*4" # stdout: 20, exit 0 python calc.py "7/2" # stdout: 3.5, exit 0 python calc.py "4/2" # stdout: 2, exit 0 python calc.py "1/0" # stderr: error: division by zero, exit 1 python calc.py "1 +" # stderr: error: unexpected token ..., exit 1 ``` **WHERE:** `calc.py` (top-level CLI) ### D5 — tests green + end-to-end **WHAT:** Full suite (lex + parse + eval) passes with 0 failures, 68 tests total. **HOW:** `python -m unittest -q` **EXPECTED:** `Ran 68 tests in 0.0xxs\nOK` **WHERE:** `calc/test_lexer.py` (25), `calc/test_parser.py` (23), `calc/test_evaluator.py` (20)