spec: Phase 0 spec gate (P0-1, P0-2, P0-3)
- text AIR format 0: grammar (reference/air-text.ebnf) and module, block, SSA, type and canonical-form rules (spec 07 §8) - instruction contracts for format 0 (new spec 07a) - traps: stable T0xxx codes and trap records (spec 01 §6) - integer edge cases and explicit casts (spec 02 §2.1) - fixed verifier resource limits (spec 08 §7) - target description with pointer_bits (spec 09 §9) - new codes E0001-E0006, E1003, T0001-T0007 - resolves Q-001, Q-003..Q-008, Q-018; Q-002 resolved for format 0
This commit is contained in:
1 parent
11ce6cb38c
commit
41b764ccfd
13 files changed
+425
-18
No files matched your search
@@ -6,14 +6,14 @@ Status values: `open`, `resolved`.
|
||||
|
||||
| ID | Status | Blocks | Question |
|
||||
|---|---|---|---|
|
||||
| Q-001 | open | P0 | Text AIR grammar |
|
||||
| Q-001 | resolved | P0 | Text AIR grammar |
|
||||
| Q-002 | open | P0 | Instruction contract tables |
|
||||
| Q-003 | open | P0 | Diagnostic codes for parse errors |
|
||||
| Q-004 | open | P0 | Observable trap semantics |
|
||||
| Q-005 | open | P0 | Verifier resource budget values |
|
||||
| Q-006 | open | P0 | Target description for `usize` and layout in the interpreter |
|
||||
| Q-007 | open | P0 | Integer edge cases besides overflow |
|
||||
| Q-008 | open | P0 | How `hello` writes output before capabilities exist |
|
||||
| Q-003 | resolved | P0 | Diagnostic codes for parse errors |
|
||||
| Q-004 | resolved | P0 | Observable trap semantics |
|
||||
| Q-005 | resolved | P0 | Verifier resource budget values |
|
||||
| Q-006 | resolved | P0 | Target description for `usize` and layout in the interpreter |
|
||||
| Q-007 | resolved | P0 | Integer edge cases besides overflow |
|
||||
| Q-008 | resolved | P0 | How `hello` writes output before capabilities exist |
|
||||
| Q-009 | open | P1 | Borrow lifetimes in AIR |
|
||||
| Q-010 | open | P1 | Region generation checks: static, dynamic, or both |
|
||||
| Q-011 | open | P2 | Effect hierarchy and discharge |
|
||||
@@ -23,7 +23,7 @@ Status values: `open`, `resolved`.
|
||||
| Q-015 | open | P5 | Operational weak-memory model for the interpreter |
|
||||
| Q-016 | open | P0 | Floating-point determinism |
|
||||
| Q-017 | open | P5 | Replay file format |
|
||||
| Q-018 | open | P2 | Runtime diagnostics (traps) vs verifier diagnostics |
|
||||
| Q-018 | resolved | P2 | Runtime diagnostics (traps) vs verifier diagnostics |
|
||||
|
||||
## Q-001 — Text AIR grammar
|
||||
|
||||
@@ -31,36 +31,52 @@ Spec 07 shows illustrative AIR but no grammar. Undecided: comment syntax; consta
|
||||
|
||||
Proposed home: `docs/reference/air-text.ebnf` plus normative text in spec 07.
|
||||
|
||||
**Resolved (P0-1):** `docs/reference/air-text.ebnf` and spec 07 §8. Comments use `;`; opcodes carry the type suffix (`add.checked.u64`, `const.u64 5`); the module header is four lines (`module`, `air`, `lang`, `features`).
|
||||
|
||||
## Q-002 — Instruction contract tables
|
||||
|
||||
Spec 07 §4 and RFC 0004 require per-opcode contracts (operands, results, ownership/borrow transition, memory set, sync, effects, capabilities, traps, transfer function, interpreter behavior). None are written. Each phase must write the contracts for the opcodes it introduces before implementing them.
|
||||
|
||||
Proposed home: a normative `docs/spec/07-air.md` appendix or `docs/spec/air/` per instruction family.
|
||||
|
||||
**Partially resolved (P0-3):** format-version-0 instructions are specified in spec 07a. Stays open for the instructions of later phases.
|
||||
|
||||
## Q-003 — Diagnostic codes for parse errors
|
||||
|
||||
The registry has no codes for malformed AIR text. Options: a new `E0xxx` range for syntax, or `E50xx` under AIR/verifier.
|
||||
|
||||
**Resolved (P0-1):** new range `E0xxx` (E0001–E0006) for text and module errors. Undefined values and unknown block labels use the semantic codes `E5001` and `E5002`.
|
||||
|
||||
## Q-004 — Observable trap semantics
|
||||
|
||||
Spec 01 §6 defines a trap as termination "according to runtime policy". The interpreter needs: trap kinds (overflow, assert, bounds, explicit, …), how a trap is reported (exit status, structured record), and whether the trap location is observable.
|
||||
|
||||
**Resolved (P0-2):** spec 01 §6. Traps terminate the program and produce a record with a stable `T0xxx` code, function, block and instruction index.
|
||||
|
||||
## Q-005 — Verifier resource budget values
|
||||
|
||||
Spec 08 §7 says budgets are "configured/spec-defined". A user-configurable budget would let a flag change which programs are accepted, which conflicts with "no compiler flags that change language semantics". Proposal: fixed spec-defined budgets per profile, reported in `E5101`.
|
||||
|
||||
**Resolved (P0-2):** fixed, non-configurable limits in spec 08 §7.
|
||||
|
||||
## Q-006 — Target description in the interpreter
|
||||
|
||||
`usize`/`isize` match the target pointer width (spec 02 §1) and struct layout is implementation-defined (spec 02 §7). For determinism the interpreter must run against an explicit target description. Undecided: format, default, and whether it is part of the AIR module (spec 00 §5 "optional target requirements").
|
||||
|
||||
**Resolved (P0-2):** spec 09 §9. Target description with `pointer_bits`; the interpreter defaults to `air64`. `usize`/`isize` are never `widen` operands, so verification is target-independent.
|
||||
|
||||
## Q-007 — Integer edge cases besides overflow
|
||||
|
||||
Unspecified: division and remainder by zero; signed `MIN / -1`; shift amounts ≥ bit width; signed right shift; casts between widths and signedness (spec 01 §2 forbids implicit conversion but explicit cast semantics are absent).
|
||||
|
||||
**Resolved (P0-2):** spec 02 §2.1 and spec 07a.
|
||||
|
||||
## Q-008 — `hello` before capabilities
|
||||
|
||||
Phase 0's exit criterion runs AIR `hello`, but `io.stdout_write` needs `cap<io.write>` (Phase 2). Options: bring a minimal `io.write` capability and intrinsic into Phase 0, or define Phase 0 `hello` as a function whose return value the test harness checks.
|
||||
|
||||
**Resolved (P0-2):** Phase 0 `hello` is a `@main` that returns a value which `aji run` reports (spec 07a "Run result"). A `hello` that writes to stdout moves to P2-11, after slices (P1) and capabilities (P2).
|
||||
|
||||
## Q-009 — Borrow lifetimes in AIR
|
||||
|
||||
Spec 03 §4 shows `'a` lifetimes in source; AIR has `borrow.ref`/`borrow.end` but no notation for lifetime relationships across function signatures. Undecided: explicit lifetime parameters in AIR signatures vs scope-based borrows only.
|
||||
@@ -100,3 +116,5 @@ Spec 11 §4 mentions `.ajr` files without a format or compatibility rule.
|
||||
## Q-018 — Runtime diagnostics
|
||||
|
||||
The error registry covers verifier/compiler errors. Traps and runtime check failures (bounds, generation, overflow) need stable machine-readable records too, either in the same registry (e.g. `R` codes) or a separate one.
|
||||
|
||||
**Resolved (P0-2):** traps share the registry in a separate `T0xxx` range (`docs/reference/error-codes.md`).
|
||||
Reference in new issue
Block a user