artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,9 @@
|
||||
# JOURNAL-eval
|
||||
|
||||
## Design notes
|
||||
|
||||
**evaluator.py**: Straightforward AST walker. `_normalize(v)` converts a float to int when `v == int(v)` — this handles the D3 requirement cleanly for both direct integer arithmetic and whole-valued division results. Division by zero is caught before the `/` operation and wrapped as `EvalError`.
|
||||
|
||||
**calc.py**: Catches `LexError`, `ParseError`, and `EvalError`; prints `error: <message>` to stderr and exits 1. No traceback leaks.
|
||||
|
||||
**test_evaluator.py**: 13 tests covering all D1 arithmetic cases, D2 true division and EvalError, D3 type assertions. Full 42-test suite (lex 16 + parse 13 + eval 13) passes.
|
||||
Reference in New Issue
Block a user