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,37 @@
# JOURNAL — phase parse
## Implementation run
### Grammar chosen
```
expr → term (('+' | '-') term)*
term → unary (('*' | '/') unary)*
unary → '-' unary | primary
primary → NUMBER | '(' expr ')'
```
`while` loops in `expr`/`term` give left-associativity automatically. `unary` recurses right for `--x` chains.
### Local verification output
```
$ python -m unittest -q
----------------------------------------------------------------------
Ran 39 tests in 0.001s
OK
$ python -c "...all gate assertions..."
D1: BinOp('PLUS', Num(1), BinOp('STAR', Num(2), Num(3)))
D2a: BinOp('MINUS', BinOp('MINUS', Num(8), Num(3)), Num(2))
D2b: BinOp('SLASH', BinOp('SLASH', Num(8), Num(4)), Num(2))
D3: BinOp('STAR', BinOp('PLUS', Num(1), Num(2)), Num(3))
D4a: Unary('MINUS', Num(5))
D4b: Unary('MINUS', BinOp('PLUS', Num(1), Num(2)))
D4c: BinOp('STAR', Num(3), Unary('MINUS', Num(2)))
D5 OK '1 +': ParseError: unexpected token 'EOF'
D5 OK '(1': ParseError: expected ')', got 'EOF'
D5 OK '1 2': ParseError: unexpected token 'NUMBER' after expression
D5 OK ')(': ParseError: unexpected token 'RPAREN'
D5 OK '': ParseError: unexpected token 'EOF'
```