spec: single normative source, accept RFC 0004, freeze AIR format 0, fuel

Owner decisions after the Phase 0 review:

- precedence: docs/spec/ is the single normative source; RFCs are
  decision records whose accepted rules are integrated into the spec in
  the same change (AGENTS.md, docs/README.md, rfcs/README.md, DD-011)
- RFC 0004 Accepted (scope: AIR format 0, language 0.1)
- AIR format 0 frozen as the semantic baseline; spec 07 §8.7 defines the
  only permitted additive changes, everything else needs `air 1` (DD-012)
- Q-019 resolved: deterministic instruction fuel (spec 11 §7). Outcome
  `limit_exceeded` is a runner outcome, not a trap; `aji run --fuel N`,
  exit code 5; conformance runs always use fuel (default 1 000 000,
  `fuel:` header); fuel/schedule budget/quantum kept separate for P3
  (DD-013)
This commit is contained in:
dev committed 2026-10-04 12:40:32 +03:00
1 parent dc36b5cfc0
commit 03dda1245a
24 files changed
+268 -63

No files matched your search

+14 -1
View File
@@ -212,7 +212,7 @@ An implementation MUST reject a module whose `air` format version or `lang` vers
- Integer types, `bool`, `void` and `never` are built in. `usize`/`isize` are distinct from all fixed-width types; their width comes from the target description (spec 09 §9).
- `type @T = struct { … }` and `type @T = enum { … }` declare nominal aggregate types. An aggregate MUST NOT contain itself by value, directly or through other aggregates (`E1003`).
- In format version 0 every value is copyable; ownership categories arrive with format version 1 (Phase 1).
- Every type defined in this section is copyable. Types added later under §8.7 (for example `Own<T>` in Phase 1) may be move-only or linear; that does not change the types defined here.
- `void` is only valid as a function return type. A `void` function returns with `ret` without operand; a call to it MUST NOT bind a result. A `never` function MUST NOT contain `ret`.
### 8.4 Reserved
@@ -228,3 +228,16 @@ Serializing a parsed module and parsing the result MUST yield an equal module.
### 8.6 Diagnostic order
Verification stops after the first stage that reports an error, in this order: parsing and name resolution, resource limits, CFG structure, SSA, types. Within a stage, diagnostics are ordered by source position. The result is therefore deterministic for a given input.
### 8.7 Stability of format 0
Format 0 is the frozen semantic baseline of AIR (RFC 0004, Accepted). Its existing constructs keep their meaning for as long as `air 0` exists.
A change is permitted under `air 0` only if all of the following hold:
1. every module accepted before the change is still accepted and produces the same run record (spec 07a "Run result") or the same trap record;
2. every module rejected before the change is still rejected with the same codes, **except** where the rejection was `E0004` (unknown opcode or type name) or `E0006` (reserved type or unsupported feature) and the change gives that name a meaning;
3. the change adds instructions, types, header features, diagnostic codes or trap codes, and specifies each new instruction in spec 07a before it is implemented;
4. the canonical form (§8.5) of existing constructs is unchanged.
Any other change to format 0 — a different meaning, typing rule, trap behavior, diagnostic code or canonical spelling for an existing construct — requires a new format version (`air 1`) introduced by an RFC. An implementation that supports several format versions selects the semantics by the module's `air` line; it never mixes them.