774 B
774 B
JOURNAL — phase eval
Session 1
Built:
calc/evaluator.py—EvalError,evaluate(node) -> int | floatwalking Num/BinOp/Unary AST nodes; true division; raisesEvalErroron divide-by-zero.calc/test_evaluator.py— 18 unittest cases covering D1–D3: arithmetic, division, EvalError, result types.calc.py— top-level CLI;_fmt()converts whole-valued floats to int display; catches LexError/ParseError/EvalError and prints to stderr with exit code 1.
Verification results:
- All 46 tests pass (
python -m unittest -q). - All 6 CLI spot-checks pass (2+3*4→14, (2+3)*4→20, 7/2→3.5, 4/2→2, 1/0→error/exit1, 1+→error/exit1).
- stderr isolation confirmed (error messages go to stderr only, no traceback).
Commit: c5e74ed