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 — lex phase
## DONE
All DoD gates D1D4 implemented and self-certified (BUILD phase — DEFERRED review protocol).
---
## What was built
- `calc/__init__.py` — makes `calc` a package
- `calc/lexer.py``Token`, `LexError`, `tokenize(src) -> list[Token]`
- `calc/test_lexer.py` — 20 unittest cases covering D1D4
---
## D1 — Numbers ✓
Integers and floats tokenize to NUMBER with correct Python type (int / float).
Verify:
```bash
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('42')])"
# Expected: [('NUMBER', 42), ('EOF', None)]
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('.5')])"
# Expected: [('NUMBER', 0.5), ('EOF', None)]
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('10.')])"
# Expected: [('NUMBER', 10.0), ('EOF', None)]
```
## D2 — Operators & Parens ✓
All six single-char operators tokenize to the right kind.
Verify:
```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']
```
## D3 — Whitespace & Errors ✓
Spaces/tabs skipped; invalid chars raise `LexError` with char + position.
Verify:
```bash
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
# Expected: raises calc.lexer.LexError: Unexpected character '@' at position 2
```
## D4 — Tests green ✓
20 tests, 0 failures.
Verify:
```bash
python -m unittest -q
# Expected: Ran 20 tests in 0.00xs / OK
```
---
## Plan verify commands (from lex.md)
```bash
python -m unittest -q
# → Ran 20 tests in 0.001s / 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')"
# → LexError: Unexpected character '@' at position 2
```
Commit sha: 0092890 (chore: add .gitignore, remove tracked pycache)
009755c (feat(lex): implement lexer, Token, LexError, and test suite)