Owner decision after the native smoke: a minimal .aji frontend over the frozen Phase 0-3 semantics (removes SSA, block parameters, CFG, feature header; keeps every semantically significant action explicit), with quantitative targets; quick reference and generic diagnostics in parallel; new harder held-out benchmark; four conditions Rust, Zig, Aji/AIR, Aji/source. Protocol: seen held-out tasks become dev material.
3.3 KiB
Phase 6 — Source language
Non-normative. Part of the implementation plan.
Goal: .aji source that lowers deterministically and explicitly to AIR, with diagnostics mapped back to source spans.
Phase 6A (brought forward, owner decision 2026-10-05). First a minimal frontend for the frozen semantics of Phases 0–3, with no new semantics. Its principle: .aji removes mechanical work but never hides a semantically significant action.
| Removed | SSA values, block parameters, the hand-written CFG, the features [...] header (inferred), intermediate values, boilerplate |
| Kept explicit | move, borrow and mutable borrow, allocation, resource ownership, capabilities, effects, task spawn and join, channel ownership transfer, locking, cancellation, fallible I/O |
Targets and the evaluation order are in README.md. Phase 6A is specified by RFC 0013. Generics, contracts, modules and the formatter (P6-4, P6-6, P6-8) stay for the full Phase 6.
Exit criterion: all reference programs and examples/ are authored primarily as .aji and pass the conformance corpus through the frontend.
Spec inputs: spec 01, 02, 03 §4, 06 §3–4, 13 §1–2; reference/grammar.ebnf.
Rule: a source feature is acceptable only if its lowering to AIR is deterministic, explicit and mechanically verifiable (spec 01 §8). The frontend is outside the TCB; the verifier still checks its output.
Tasks
| ID | Status | Task | Depends | Output | Done when |
|---|---|---|---|---|---|
| P6-1 | todo | Complete the source grammar: expressions, match, borrow blocks, task.scope, select, defer, ?, generics, lifetimes, contracts, attributes |
— (may start after P2) | reference/grammar.ebnf, spec 01 |
every construct in examples/ is covered; grammar is LL(k) or otherwise documented as unambiguous |
| P6-2 | todo | Lexer and parser with spans | P6-1 | src/frontend/{lex,parse}.zig |
all examples/ parse; syntax errors are registered diagnostics |
| P6-3 | todo | Modules, imports, name resolution | P6-2 | src/frontend/resolve.zig |
unresolved names produce registered diagnostics |
| P6-4 | todo | Type checking and monomorphized generics with structural constraints (Copy, Send, Share, Freeze, Local) |
P6-3 | src/frontend/types.zig |
generic code instantiates deterministically; constraint violations diagnosed |
| P6-5 | todo | Lowering to AIR: control flow, ?, defer cleanup edges, borrow blocks, task scopes |
P6-4 | src/frontend/lower.zig |
lowered AIR verifies; lowering is a pure function (same input ⇒ same AIR bytes) |
| P6-6 | todo | Contracts: requires/ensures/invariants → contract table; status classification |
P6-5 | frontend + verifier | each contract reported as PROVEN_STATICALLY / CHECKED_AT_RUNTIME / ASSUMED_UNSAFE / UNPROVEN |
| P6-7 | todo | Source spans in diagnostics for verifier errors on lowered AIR | P6-5 | src/diag.zig, lowering |
every conformance reject test has a source-level twin with the same code |
| P6-8 | todo | Formatter | P6-2 | aji fmt |
idempotent; output parses to the same AST |
| P6-9 | todo | Port reference programs and examples to .aji |
P6-5 | tests/programs/, examples/ |
exit criterion passes |
| P6-10 | todo | Phase exit review | all | plan status | exit criterion passes |