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,104 @@
# STATUS — phase lex
## Gates
### D1 — numbers
**What:** Integers and floats tokenize to NUMBER with correct numeric value (int or float).
**Command:**
```bash
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('42')])"
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.14')])"
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('.5')])"
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('10.')])"
```
**Expected:** NUMBER with int value for integers; float for `3.14`, `.5`, `10.`
**Observed:**
```
[('NUMBER', 42), ('EOF', None)] # int
[('NUMBER', 3.14), ('EOF', None)] # float
[('NUMBER', 0.5), ('EOF', None)] # leading dot
[('NUMBER', 10.0), ('EOF', None)] # trailing dot
```
**Result: PASS**
---
### D2 — operators & parens
**What:** `+ - * / ( )` each tokenize to their correct kind.
**Command:**
```bash
python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize('1+2*3')])"
```
**Expected:** `['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF']`
**Observed:** `['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF']`
**Result: PASS**
---
### D3 — whitespace & errors
**What:** Spaces/tabs skipped; invalid chars raise LexError with char and position.
**Command:**
```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:** Whitespace version → `['NUMBER', 'PLUS', 'NUMBER', 'EOF']`; `@` raises `LexError` with `@` and position `2` in message.
**Observed:**
- Whitespace: `['NUMBER', 'PLUS', 'NUMBER', 'EOF']`
- LexError: `calc.lexer.LexError: unexpected character '@' at position 2`
**Result: PASS**
---
### D4 — tests green
**What:** `calc/test_lexer.py` passes `python -m unittest`, 0 failures, covering D1D3.
**Command:**
```bash
python -m unittest -q
```
**Expected:** `Ran N tests in ... OK`
**Observed:**
```
----------------------------------------------------------------------
Ran 18 tests in 0.000s
OK
```
**Result: PASS**
---
### Exact plan verification commands
```bash
python -m unittest -q
# → Ran 18 tests in 0.000s OK
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])"
# → [('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
# → calc.lexer.LexError: unexpected character '@' at position 2
```
## DONE