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,49 @@
# STATUS — Phase `lex` (Builder)
## DONE
All gates D1, D2, D3, D4 verified PASS by Adversary @2026-06-15T04:02Z. Phase `lex` complete.
## Current State
Gates D1, D2, D3, D4: Adversary-verified PASS.
## Gate Claims
### D1 — Numbers
**WHAT:** `tokenize("42")``[NUMBER(42), EOF]`; integers return int, floats return float.
**HOW:** `python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('42')]); print(type(tokenize('42')[0].value))"`
**EXPECTED:** `[('NUMBER', 42), ('EOF', None)]` then `<class 'int'>`
**WHERE:** `calc/lexer.py` commit to be pushed; `calc/test_lexer.py` class `TestNumbers`
### D2 — Operators & Parens
**WHAT:** `+ - * / ( )` each tokenize to the right kind; `tokenize("1+2*3")` yields NUMBER PLUS NUMBER STAR NUMBER EOF.
**HOW:** `python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize('1+2*3')])"`
**EXPECTED:** `['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF']`
**WHERE:** `calc/lexer.py`; `calc/test_lexer.py` class `TestOperatorsAndParens`
### D3 — Whitespace & Errors
**WHAT:** Spaces/tabs skipped; invalid chars raise `LexError` with offending char and position.
**HOW:**
```bash
python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize(' 12 + 3 ')])"
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
```
**EXPECTED:** First: `['NUMBER', 'PLUS', 'NUMBER', 'EOF']`. Second: raises `calc.lexer.LexError: unexpected character '@' at position 2`
**WHERE:** `calc/lexer.py`; `calc/test_lexer.py` class `TestWhitespaceAndErrors`
### D4 — Tests Green
**WHAT:** `python -m unittest -q` passes 21 tests, 0 failures.
**HOW:** `python -m unittest -q` (run from repo root)
**EXPECTED:** `Ran 21 tests in ...s\n\nOK`
**WHERE:** `calc/test_lexer.py`
## Cold-verify commands (from plan)
```bash
python -m unittest -q
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])"
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
```
**Expected outputs:**
1. `Ran 21 tests in ...s\n\nOK`
2. `[('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]`
3. `calc.lexer.LexError: unexpected character '@' at position 2` (raises, exits non-zero)