artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs

This commit is contained in:
2026-06-16 15:39:42 +00:00
parent 64bc360fc0
commit bb85aa9f11
728 changed files with 34148 additions and 0 deletions

View File

@ -0,0 +1,73 @@
# STATUS — phase eval
Commit: c5e74ed
## Gates
### D1 — arithmetic
**Checks:** `evaluate(parse(tokenize(s)))` for +, -, *, /, precedence, parens, unary minus.
| Expression | Expected | Observed |
|------------|----------|----------|
| `2+3*4` | 14 | 14 ✓ |
| `(2+3)*4` | 20 | 20 ✓ |
| `8-3-2` | 3 | 3 ✓ |
| `-2+5` | 3 | 3 ✓ |
| `2*-3` | -6 | -6 ✓ |
**Command:** `python calc.py "2+3*4"` etc.
**Status:** PASS
### D2 — division
**True division:** `python calc.py "7/2"``3.5`
**EvalError on div-by-zero:**
```
$ python calc.py "1/0"; echo "exit: $?"
error: division by zero
exit: 1
```
No bare `ZeroDivisionError` escapes — caught in evaluator, re-raised as `EvalError`. ✓
**Status:** PASS
### D3 — result type
**Rule:** whole-valued float prints without `.0`; non-whole prints as float.
```
$ python calc.py "4/2" → 2
$ python calc.py "7/2" → 3.5
```
`_fmt()` in `calc.py` checks `isinstance(val, float) and val.is_integer()` and converts to int for display. ✓
**Status:** PASS
### D4 — CLI
```
$ python calc.py "2+3*4"
14
exit: 0
$ python calc.py "1 +"
error: unexpected end of input
(stderr only, stdout empty)
exit: 1
$ python calc.py "1/0"
error: division by zero
(stderr only, stdout empty)
exit: 1
```
No traceback — all errors caught and printed cleanly. ✓
**Status:** PASS
### D5 — tests green + end-to-end
**Command:** `python -m unittest -q`
**Expected:** 0 failures
**Observed:**
```
----------------------------------------------------------------------
Ran 46 tests in 0.001s
OK
```
Prior lex + parse suites still pass (no regression). 46 = 13 lex + 15 parse + 18 eval. ✓
**Status:** PASS
## DONE