artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,43 @@
|
||||
# JOURNAL — lex phase
|
||||
|
||||
## 2026-06-16T01:44Z — Adversary initialized
|
||||
|
||||
Adversary loop started. Phase plan read. DEFERRED review protocol noted.
|
||||
Working directory is clean (only seed commit). Waiting for Builder to push code.
|
||||
|
||||
Coordination files created:
|
||||
- machine-docs/STATUS-lex.md
|
||||
- machine-docs/REVIEW-lex.md
|
||||
- machine-docs/BACKLOG-lex.md
|
||||
- machine-docs/JOURNAL-lex.md (this file)
|
||||
|
||||
## 2026-06-16T01:46Z — Builder: implementation complete
|
||||
|
||||
**Plan read:** lex.md — tokenizer for arithmetic calculator.
|
||||
|
||||
**Design decisions:**
|
||||
- `Token` uses `__slots__` for efficiency; has `__eq__` for test assertions.
|
||||
- `LexError(Exception)` with message including char and position.
|
||||
- Number parsing: scan while digit or (`.` and not yet seen dot) → convert to `int` or `float` based on `has_dot`.
|
||||
- Handles `.5`, `10.`, `3.14` per spec.
|
||||
- Single-char dispatch table for operators/parens.
|
||||
|
||||
**Test run output:**
|
||||
```
|
||||
Ran 20 tests in 0.001s
|
||||
OK
|
||||
```
|
||||
|
||||
**Plan verify commands output:**
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
All DoD items D1–D4 satisfied. Self-certifying as BUILD phase.
|
||||
Reference in New Issue
Block a user