Initial import: Aji 0.1 draft spec and Zig scaffolding
Draft specification, RFCs, reference registries and examples, plus the reference-implementation skeleton: build.zig, diagnostic envelope with error-code registry synced to docs, aji CLI, conformance runner with seed tests, CI and contributor docs.
This commit is contained in:
commit
17a55a7fef
67 files changed
+4197
No files matched your search
@@ -0,0 +1,42 @@
|
||||
# Conformance suite
|
||||
|
||||
Run with `zig build conformance` (add `-- --json` for JSON Lines, `-- --filter <substring>` to narrow).
|
||||
|
||||
## Layout
|
||||
|
||||
```text
|
||||
tests/conformance/
|
||||
phase<N>/accept/*.air modules a conforming verifier MUST accept
|
||||
phase<N>/reject/*.air modules a conforming verifier MUST reject
|
||||
```
|
||||
|
||||
`phase<N>` is the roadmap phase (`docs/roadmap/implementation-plan.md`) that first requires the test to pass.
|
||||
|
||||
## Test header
|
||||
|
||||
Every test starts with a block of `;` lines. Keys:
|
||||
|
||||
| Key | Required | Value |
|
||||
|---|---|---|
|
||||
| `expect` | yes | `accept`, or `reject` followed by one or more codes from `docs/reference/error-codes.md` |
|
||||
| `phase` | yes | roadmap phase number |
|
||||
| `spec` | yes | spec section that justifies the expectation |
|
||||
|
||||
Header lines without a `key:` are free-form description. The runner blanks the header before handing the module to the pipeline, so line numbers in diagnostics are unchanged and the AIR grammar does not need to know about test metadata.
|
||||
|
||||
`reject` compares the exact multiset of error codes. Listing a code twice means two diagnostics with that code are expected.
|
||||
|
||||
## Outcomes
|
||||
|
||||
| Outcome | Meaning |
|
||||
|---|---|
|
||||
| `PASS` | result matches `expect` |
|
||||
| `FAIL` | result differs, or the header is malformed; the run exits 1 |
|
||||
| `PENDING` | the pipeline stage needed for this input is not implemented yet |
|
||||
|
||||
## Rules
|
||||
|
||||
- Every verifier rule gets at least one `accept` and one `reject` test (AGENTS.md, testing policy).
|
||||
- One defect per `reject` test. A test that triggers several unrelated errors is hard to repair against.
|
||||
- Keep tests minimal: the smallest module that exhibits the rule.
|
||||
- Text AIR syntax in the seed tests is provisional until the text AIR grammar is specified (Phase 0, task P0-1). Update the tests when the grammar lands.
|
||||
@@ -0,0 +1,22 @@
|
||||
; Counting loop passing state through block parameters instead of phi nodes.
|
||||
; expect: accept
|
||||
; phase: 0
|
||||
; spec: docs/spec/07-air.md
|
||||
fn @count(%n: u64) -> u64
|
||||
effects []
|
||||
|
||||
entry:
|
||||
%zero = const.u64 0
|
||||
br @loop(%zero)
|
||||
|
||||
loop(%i: u64):
|
||||
%done = ge.u64 %i, %n
|
||||
cbr %done, @exit(%i), @body(%i)
|
||||
|
||||
body(%j: u64):
|
||||
%one = const.u64 1
|
||||
%next = add.checked.u64 %j, %one
|
||||
br @loop(%next)
|
||||
|
||||
exit(%r: u64):
|
||||
ret %r
|
||||
@@ -0,0 +1,10 @@
|
||||
; Checked addition of two parameters.
|
||||
; expect: accept
|
||||
; phase: 0
|
||||
; spec: docs/spec/07-air.md
|
||||
fn @sum(%a: u64, %b: u64) -> u64
|
||||
effects []
|
||||
|
||||
entry:
|
||||
%0 = add.checked.u64 %a, %b
|
||||
ret %0
|
||||
@@ -0,0 +1,9 @@
|
||||
; The only block falls off its end without a terminator.
|
||||
; expect: reject E5002
|
||||
; phase: 0
|
||||
; spec: docs/spec/07-air.md
|
||||
fn @f(%a: u64) -> u64
|
||||
effects []
|
||||
|
||||
entry:
|
||||
%0 = add.checked.u64 %a, %a
|
||||
@@ -0,0 +1,10 @@
|
||||
; add.checked.u64 applied to a u32 operand.
|
||||
; expect: reject E1001
|
||||
; phase: 0
|
||||
; spec: docs/spec/02-types-and-values.md
|
||||
fn @f(%a: u64, %b: u32) -> u64
|
||||
effects []
|
||||
|
||||
entry:
|
||||
%0 = add.checked.u64 %a, %b
|
||||
ret %0
|
||||
@@ -0,0 +1,10 @@
|
||||
; %c is used but never defined.
|
||||
; expect: reject E5001
|
||||
; phase: 0
|
||||
; spec: docs/spec/07-air.md
|
||||
fn @f(%a: u64) -> u64
|
||||
effects []
|
||||
|
||||
entry:
|
||||
%0 = add.checked.u64 %a, %c
|
||||
ret %0
|
||||
@@ -0,0 +1,11 @@
|
||||
; %p is moved into %q and then used again.
|
||||
; expect: reject E2001
|
||||
; phase: 1
|
||||
; spec: docs/spec/03-memory-model.md
|
||||
fn @f(%p: Own<u64>) -> Own<u64>
|
||||
effects []
|
||||
|
||||
entry:
|
||||
%q = move %p
|
||||
%r = move %p
|
||||
ret %r
|
||||
Reference in new issue
Block a user