P4-11: air-text.ebnf covers the syntax of Phases 2–4
Types cap<K>, resources, own/region, scope/task/shield, endpoints, mutex/guard, island/frozen/iref/arc and the built-in enums; productions for capability, heap, region, task, cancellation, channel, sync and graph instructions, with the named-edge terminator forms. Every opcode in the conformance corpus and in the spec contract tables has a production. AIR bundle +3.6 % (cl100k), recorded.
This commit is contained in:
1 parent
c699529fec
commit
3c5c129078
4 files changed
+122
-5
No files matched your search
@@ -48,6 +48,7 @@ Growth never blocks a merge automatically; a complex feature can be justified, b
|
||||
| RFC 0012 waits, channels, select, mutex | 19 | 38 | 133 781 | 20 748 | 35 119 (+15.8 %) | 35 219 (+15.7 %) | 36 238 (+15.7 %) |
|
||||
| Phase 3 implementation | 19 | 38 | 134 576 | 20 884 | 35 324 (+0.6 %) | 35 424 (+0.6 %) | 36 453 (+0.6 %) |
|
||||
| RFC 0014 islands, frozen graphs, arc (Phase 4) | 19 | 41 | 142 918 | 22 212 | 37 785 (+7.0 %) | — | — |
|
||||
| P4-11 AIR text grammar for Phases 2–4 | 19 | 41 | 149 279 | 22 945 | 39 154 (+3.6 %) | 39 306 | 40 382 |
|
||||
|
||||
RFC 0011 crossed the 10 % warning line (its own estimate said "below 10 %"): four new sections in spec 04 (tasks, loans, `Send`/`Share` table, scheduler). Below the 20 % review threshold. RFC 0012 (+15.8 %, estimate 12–16 %): five sections in spec 04 (waits and cancellation, channels, select, mutex, critical-section rule). Implementation-time spec corrections (mutex linearity, `mutex.take` rules): +0.6 %. Phase 3 total since the Phase 2 baseline: +29.2 %. Next measurement: after the E-S smoke test, or with the next RFC.
|
||||
|
||||
|
||||
@@ -78,5 +78,21 @@
|
||||
"o200k_base": 37888,
|
||||
"qwen2.5": 38988
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "P4-11 AIR text grammar for Phases 2\u20134",
|
||||
"language": "aji",
|
||||
"air": 0,
|
||||
"phase": 3,
|
||||
"files": 19,
|
||||
"sections": 41,
|
||||
"bytes": 149279,
|
||||
"lines": 2218,
|
||||
"words": 22945,
|
||||
"tokens": {
|
||||
"cl100k_base": 39154,
|
||||
"o200k_base": 39306,
|
||||
"qwen2.5": 40382
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -35,7 +35,7 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
| P4-7 | done | `.aji` layer 9: types, operations, `island.at`/`frozen.at`/`arc.at` places, explicit container borrows; Quick Reference section; source coverage rows | P4-3 | `src/frontend/`, `docs/agent/` | `.aji` run/reject tests; Quick Reference examples checked; `tools/source_coverage.py` passes |
|
||||
| P4-8 | done | Reference program `island-pipeline` in AIR and `.aji` with equivalence | P4-4, P4-5, P4-6, P4-7 | `tests/conformance/` | passes under all P3 stress modes |
|
||||
| P4-9 | done | Complexity budget: AIR bundle, Quick Reference, Source Reference Bundle measured against the RFC estimate | P4-7 | `docs/agent/README.md` | growth recorded and justified |
|
||||
| P4-11 | todo | `reference/air-text.ebnf` covers the syntax of Phases 2–4: `cap<K>`, endpoint, task, graph and built-in types; `own.*`, `task.*`, `channel.*` (with the type operand of `channel.make`), `island.*`/`frozen.*`/`arc.*`/`iref.eq`; the multi-edge terminator forms (found by the independent author of `program_island_pipeline.air`) | — | `docs/reference/air-text.ebnf` | every instruction of spec 07a and spec 03 §22–§24 has a production |
|
||||
| P4-11 | done | `reference/air-text.ebnf` covers the syntax of Phases 2–4: `cap<K>`, endpoint, task, graph and built-in types; `own.*`, `task.*`, `channel.*` (with the type operand of `channel.make`), `island.*`/`frozen.*`/`arc.*`/`iref.eq`; the multi-edge terminator forms (found by the independent author of `program_island_pipeline.air`) | — | `docs/reference/air-text.ebnf` | every instruction of spec 07a and spec 03 §22–§24 has a production |
|
||||
| P4-10 | todo | Phase exit review | all | plan status | exit criterion passes |
|
||||
|
||||
## Conformance tests to add
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
"[" "]" and "{" "}" are ignored.
|
||||
- Spaces and tabs separate tokens and are otherwise insignificant.
|
||||
- Opcodes are written as one dotted word, e.g. "add.checked.u64".
|
||||
- Every construct marked "(* feature f *)" requires f in the module's
|
||||
"features" header (E0006 otherwise); the feature table and dependency
|
||||
closure are in docs/reference/air-features.md.
|
||||
|
||||
Name spaces
|
||||
-----------
|
||||
@@ -17,7 +20,8 @@
|
||||
module scope; block labels are scoped to their function. A label
|
||||
reference appears only in branch targets, so it never clashes
|
||||
with a function name.
|
||||
- bare field names, variant names, module path segments, effect names.
|
||||
- bare field names, variant names, module path segments, effect names,
|
||||
capability kinds, intrinsic names, edge roles.
|
||||
*)
|
||||
|
||||
module = { NL } header { NL } { declaration { NL } } ;
|
||||
@@ -25,7 +29,7 @@ module = { NL } header { NL } { declaration { NL } } ;
|
||||
header = "module" path NL
|
||||
"air" int_lit NL (* AIR text format version; this file defines 0 *)
|
||||
"lang" version_lit NL (* Aji semantic version, e.g. 0.1 *)
|
||||
"features" "[" [ path_list ] "]" NL ; (* required feature names; empty in format 0 *)
|
||||
"features" "[" [ path_list ] "]" NL ; (* required features and their full dependency closure *)
|
||||
|
||||
declaration = type_decl | function ;
|
||||
|
||||
@@ -34,6 +38,8 @@ struct_type = "struct" "{" [ field { "," field } [ "," ] ] "}" ;
|
||||
field = ident ":" type ;
|
||||
enum_type = "enum" "{" variant { "," variant } [ "," ] "}" ;
|
||||
variant = ident [ "(" [ type { "," type } ] ")" ] ;
|
||||
(* Linear types as fields, payloads or elements need features
|
||||
that are reserved in format 0; see air-features.md. *)
|
||||
|
||||
function = "fn" global "(" [ param_list ] ")" "->" type [ "from" local ] NL (* from: feature ownership *)
|
||||
"effects" "[" [ path_list ] "]" NL
|
||||
@@ -60,8 +66,24 @@ operation = "const." int_type int_lit
|
||||
| "call" global "(" [ local_list ] ")"
|
||||
| ownership_op
|
||||
| arrays_op
|
||||
| capability_op
|
||||
| heap_op
|
||||
| region_op
|
||||
| task_op
|
||||
| cancellation_op
|
||||
| channel_op
|
||||
| sync_op
|
||||
| graph_op
|
||||
| terminator ;
|
||||
|
||||
(* Several instructions are terminators with named outgoing edges (spec 07a).
|
||||
Each edge names a block of the same function; the instruction's results
|
||||
arrive as that block's parameters, so an edge carries no arguments. *)
|
||||
edge = role "->" global ;
|
||||
role = "ok" | "err" | "closed" | "cancelled" | "pending" ;
|
||||
ok_err = "," "ok" "->" global "," "err" "->" global ;
|
||||
ok_cancelled = "," "ok" "->" global "," "cancelled" "->" global ;
|
||||
|
||||
(* Feature ownership (spec 07a). *)
|
||||
ownership_op = "local.alloc" type
|
||||
| "local.store" local "," local
|
||||
@@ -86,6 +108,69 @@ arrays_op = "array.splat" type local
|
||||
| "assume" local (* feature unsafe *)
|
||||
| "borrow.index.unchecked" local "," local ; (* feature unsafe *)
|
||||
|
||||
(* Feature capabilities (spec 05 §10–§12, reference/intrinsics.md). *)
|
||||
capability_op = "cap.narrow." ident local { "," local } ok_err (* terminator; form registered for the kind *)
|
||||
| "intrinsic" path "(" [ local_list ] ")" [ ok_err ] ; (* fallible intrinsics are terminators;
|
||||
resource intrinsics need feature resources *)
|
||||
|
||||
(* Feature heap (spec 03 §18–§19). *)
|
||||
heap_op = "own.new" local "," local ok_err (* terminator: value, cap<mem.alloc> *)
|
||||
| "own.array" local "," local "," local ok_err (* terminator: count, element, cap<mem.alloc> *)
|
||||
| "own.take" local
|
||||
| "own.free" local ;
|
||||
|
||||
(* Feature regions (spec 03 §20). *)
|
||||
region_op = "region.create" local ok_err (* terminator: cap<mem.alloc> *)
|
||||
| "region.new" local "," local ok_err (* terminator: region borrow, value *)
|
||||
| "region.array" local "," local "," local ok_err (* terminator: region borrow, count, element *)
|
||||
| "region.reset" local
|
||||
| "region.destroy" local ;
|
||||
|
||||
(* Feature tasks (spec 04 §33–§36). *)
|
||||
task_op = "task.scope.begin"
|
||||
| "task.spawn" local "," global "(" [ local_list ] ")"
|
||||
| "task.join" local
|
||||
| "task.cancel" local
|
||||
| "task.cancelled"
|
||||
| "task.scope.end" local ;
|
||||
|
||||
(* Feature cancellation (spec 04 §37). *)
|
||||
cancellation_op = "task.check_cancel" ok_cancelled (* terminator *)
|
||||
| "task.join.cancel" local ok_cancelled (* terminator *)
|
||||
| "task.shield.begin"
|
||||
| "task.shield.end" local ;
|
||||
|
||||
(* Feature channels (spec 04 §38–§39). *)
|
||||
channel_op = "channel.make" type "," local "," local ok_err (* terminator: element type, capacity, cap<mem.alloc> *)
|
||||
| "channel.sender.dup" local
|
||||
| "channel.send" local "," local "," "ok" "->" global "," "closed" "->" global "," "cancelled" "->" global
|
||||
| "channel.recv" local "," "ok" "->" global "," "closed" "->" global "," "cancelled" "->" global
|
||||
| "channel.close_sender" local
|
||||
| "channel.close_receiver" local "," "ok" "->" global "," "pending" "->" global
|
||||
| "select" select_arm { select_arm } "cancelled" "->" global ; (* terminator *)
|
||||
select_arm = "[" ( "recv" local | "send" local "," local )
|
||||
"," "ok" "->" global "," "closed" "->" global "]" "," ;
|
||||
(* send, recv and close_receiver are terminators *)
|
||||
|
||||
(* Feature sync (spec 04 §40–§41). *)
|
||||
sync_op = "mutex.make" local
|
||||
| "mutex.take" local
|
||||
| "mutex.lock" local ok_cancelled (* terminator *)
|
||||
| "mutex.borrow" local
|
||||
| "mutex.unlock" local ;
|
||||
|
||||
(* Features islands and arc (spec 03 §22–§24). *)
|
||||
graph_op = "island.create" local "," local ok_err (* terminator: root value, cap<mem.alloc> *)
|
||||
| "island.alloc" local "," local ok_err (* terminator: mut<island<T>>, value *)
|
||||
| ( "island.root" | "frozen.root" | "arc.root" ) local
|
||||
| ( "island.borrow" | "frozen.borrow" | "arc.borrow" ) local "," local (* owner borrow, iref *)
|
||||
| "island.freeze" local
|
||||
| "island.destroy" local
|
||||
| "frozen.release" local
|
||||
| "iref.eq" local "," local
|
||||
| "arc.new" local "," local ok_err (* feature arc; terminator: root value, cap<mem.alloc> *)
|
||||
| ( "arc.from_frozen" | "arc.clone" | "arc.release" ) local ; (* feature arc *)
|
||||
|
||||
arith_op = ( "add" | "sub" | "mul" ) "." ( "checked" | "wrap" ) "." int_type
|
||||
| ( "div" | "rem" ) ".checked." int_type
|
||||
| ( "and" | "or" | "xor" ) "." ( int_type | "bool" )
|
||||
@@ -98,7 +183,7 @@ cast_mode = "checked" | "wrap" | "widen" ;
|
||||
terminator = "br" target
|
||||
| "cbr" local "," target "," target
|
||||
| "switch." int_type local "," { int_lit "->" target "," } "default" "->" target
|
||||
| "enum.switch" global local "," enum_arm { "," enum_arm } [ "," "default" "->" target ]
|
||||
| "enum.switch" ( global | builtin_type ) local "," enum_arm { "," enum_arm } [ "," "default" "->" target ]
|
||||
| "ret" [ local ]
|
||||
| "trap" ;
|
||||
enum_arm = ident "->" global ; (* target block receives the variant payload as parameters *)
|
||||
@@ -107,7 +192,22 @@ target = global "(" [ local_list ] ")" ;
|
||||
type = int_type | "bool" | "void" | "never" | global
|
||||
| ( "local" | "ref" | "mut" ) "<" type ">" (* feature ownership *)
|
||||
| "array" "<" type "," int_lit ">" (* feature arrays; ";" starts a comment, so source syntax [T; N] is spelled array<T, N> *)
|
||||
| ( "slice" | "slice_mut" ) "<" type ">" ; (* feature arrays *)
|
||||
| ( "slice" | "slice_mut" ) "<" type ">" (* feature arrays *)
|
||||
| "cap" "<" path ">" (* feature capabilities; a capability kind, e.g. cap<fs.read> *)
|
||||
| "file" "<" ( "read" | "write" | "append" ) ">" (* feature resources *)
|
||||
| "listener" | "stream" (* feature resources *)
|
||||
| ( "own" | "own_array" ) "<" type ">" (* feature heap *)
|
||||
| "region" (* feature regions *)
|
||||
| "scope" | "task" "<" type ">" (* feature tasks *)
|
||||
| "shield" (* feature cancellation *)
|
||||
| ( "sender" | "receiver" ) "<" type ">" (* feature channels *)
|
||||
| ( "mutex" | "guard" ) "<" type ">" (* feature sync *)
|
||||
| ( "island" | "frozen" | "iref" ) "<" type ">" (* feature islands *)
|
||||
| "arc" "<" type ">" (* feature arc *)
|
||||
| builtin_type ;
|
||||
builtin_type = "cap_error" (* feature capabilities *)
|
||||
| "alloc_error" (* feature heap *)
|
||||
| "io_error" ; (* feature resources *)
|
||||
int_type = "u8" | "u16" | "u32" | "u64" | "u128" | "usize"
|
||||
| "i8" | "i16" | "i32" | "i64" | "i128" | "isize" ;
|
||||
(* "f32" and "f64" are reserved; see spec 07 §8.4. "byte" is not an AIR type: frontends lower it to u8. *)
|
||||
|
||||
Reference in new issue
Block a user