interp: deterministic interpreter, aji run, run tests (P0-11, P0-12)

- src/interp/machine.zig: format-0 interpreter on the air64 target;
  checked/wrapping arithmetic, shifts, casts, aggregates, calls with a
  1024-frame limit, traps as records with T0xxx codes
- aji run: prints one JSON run record; exit code 4 on trap
- conformance runner: `expect: run` with `result:`/`trap:`, every run
  executed twice and compared byte-for-byte; header keys must be single
  lowercase words
- Phase 0 corpus: 3 accept, 19 reject, 15 run tests (41 total)
This commit is contained in:
dev committed 2026-10-04 12:28:27 +03:00
1 parent 50bf990355
commit 1f5008bb37
45 files changed
+1463 -23

No files matched your search

+1 -1
View File
@@ -48,7 +48,7 @@ Reason: Zig's standard library changes between minor versions; an unpinned toolc
## DD-009 — CLI diagnostics are JSON Lines on stdout
`aji` writes one JSON diagnostic per line on stdout, human notes on stderr, and uses fixed exit codes (0 accepted, 1 rejected, 2 usage/I/O, 3 not yet implemented).
`aji` writes one JSON diagnostic per line on stdout, human notes on stderr, and uses fixed exit codes (0 accepted or returned, 1 rejected, 2 usage/I/O, 3 not yet implemented, 4 trapped).
Reason: agents consume diagnostics programmatically (spec 10); mixing prose into the machine channel breaks repair loops.
+3 -4
View File
@@ -13,7 +13,7 @@ Non-normative. How the reference implementation is tested. Policy (what must be
| Schedule stress | via runner flags (from P3) | `zig build conformance -- --schedules=N` | randomized and systematic interleavings |
| Native parity | (from P7) | `zig build parity` | interpreter and native backend agree on the whole corpus |
Only unit and conformance exist today.
Unit and conformance exist today; conformance covers accept, reject and run tests.
## Conformance tests
@@ -30,9 +30,8 @@ Planned header extensions (added by the phase that needs them):
| Key | Phase | Meaning |
|---|---|---|
| `expect: run` | P0 | module must verify and run |
| `stdout:` | P0 | expected output, `\n`-escaped |
| `trap:` | P0 | expected trap kind (Q-004) |
| `expect: run` + `result:` / `trap:` | P0 (implemented) | module must verify; run record must match |
| `stdout:` | P2 | expected output, `\n`-escaped (needs `io.write`) |
| `seed:` / `schedules:` | P3 | deterministic scheduler seed / number of randomized schedules |
| `profile:` | P2 | runtime profile (`hosted`, `deterministic`, …) |