# Phase 0 — Semantic skeleton: task breakdown Non-normative. Breaks Phase 0 of `implementation-plan.md` into tasks small enough for one agent session each. Exit criterion (from the plan): AIR `hello` and arithmetic tests execute identically across runs. | ID | Task | Depends on | Output | Done when | |---|---|---|---|---| | P0-1 | Specify text AIR grammar | — | `docs/reference/air-text.ebnf`, updates to `docs/spec/07-air.md` | grammar covers module header, functions, `effects`, blocks with parameters, instructions, comments; seed tests in `tests/conformance/phase0` match it | | P0-2 | AIR data model | P0-1 | `src/air.zig` (types, values, instructions, blocks, functions, module) | round-trips through P0-4 | | P0-3 | Text AIR lexer + parser | P0-1, P0-2 | `src/air/parse.zig` | parse errors are diagnostics with spans; new parse codes registered in `error-codes.md` | | P0-4 | Canonical serializer | P0-2 | `src/air/print.zig` | `parse ∘ print` is identity on the data model; output is byte-stable | | P0-5 | CFG verifier | P0-3 | `src/verifier/cfg.zig` | `E5002` accept/reject tests pass | | P0-6 | SSA/dominance verifier | P0-5 | `src/verifier/ssa.zig` | `E5001` accept/reject tests pass | | P0-7 | Type verifier for integer ops, structs, enums | P0-3 | `src/verifier/types.zig` | `E1001` accept/reject tests pass | | P0-8 | Verifier resource budget | P0-5 | budget in `src/verifier.zig` | `E5101` emitted deterministically; budget documented in spec 08 | | P0-9 | Interpreter core | P0-6, P0-7 | `src/interp.zig` | arithmetic programs run; checked overflow traps per spec | | P0-10 | `aji run` + run tests in conformance runner | P0-9 | `expect: run` header with expected stdout/trap | `hello` and arithmetic tests pass, output identical across 100 runs | ## Open questions to resolve in P0-1 - Comment syntax in text AIR (the conformance runner currently strips leading `;` lines itself). - Spelling of constants (`const.u64 0` is provisional) and comparison results (`bool` vs `u1`). - How `hello` reaches stdout before Phase 2 capabilities exist: a test-only intrinsic, or Phase 2 `io.write` brought forward. - Whether parse errors get their own `E0xxx` range or join `E5xxx`.