docs: reorganize documentation layout
- docs/roadmap/ -> docs/plan/ (implementation-plan.md becomes plan/README.md) - docs/reference/design-decisions.md -> docs/design/decisions.md (+ DD-008..010) - SPEC.md and docs/spec/INDEX.md merged into docs/spec/README.md - new docs/design/open-questions.md: spec gaps found so far (Q-001..Q-018) - new docs/dev/architecture.md and docs/dev/testing.md - docs/README.md: layout, precedence, where new documents go - update links in README, AGENTS, CONTRIBUTING, sources and test docs
This commit is contained in:
1 parent
17a55a7fef
commit
4e4d753090
17 files changed
+384
-95
No files matched your search
@@ -0,0 +1,118 @@
|
||||
# Implementation Plan
|
||||
|
||||
## Phase 0 — Semantic skeleton
|
||||
|
||||
Deliver:
|
||||
|
||||
- AIR value/type model;
|
||||
- text AIR parser and serializer;
|
||||
- basic blocks and SSA validation;
|
||||
- integer operations;
|
||||
- structs/enums;
|
||||
- interpreter;
|
||||
- stable diagnostic envelope.
|
||||
|
||||
Exit criterion: AIR `hello` and arithmetic tests execute identically across runs.
|
||||
|
||||
## Phase 1 — Ownership and memory
|
||||
|
||||
Deliver:
|
||||
|
||||
- `Own<T>`;
|
||||
- `ref<T>` / `mut<T>`;
|
||||
- slices;
|
||||
- initialization tracking;
|
||||
- `Region` and generation semantics;
|
||||
- bounds/range facts;
|
||||
- ownership/borrow diagnostics.
|
||||
|
||||
Exit criterion: file-copy can be implemented and verifier rejects representative UAF/alias/OOB cases.
|
||||
|
||||
## Phase 2 — Effects, capabilities and resources
|
||||
|
||||
Deliver:
|
||||
|
||||
- effects;
|
||||
- capability values;
|
||||
- linear File/Socket resources;
|
||||
- runtime intrinsics;
|
||||
- explicit cleanup lowering.
|
||||
|
||||
Exit criterion: safe file-copy and basic TCP echo.
|
||||
|
||||
## Phase 3 — Structured concurrency
|
||||
|
||||
Deliver:
|
||||
|
||||
- task scopes;
|
||||
- spawn/join;
|
||||
- `Send` / `Share` derivation;
|
||||
- scoped borrowing;
|
||||
- bounded channels;
|
||||
- mutex;
|
||||
- cancellation;
|
||||
- deterministic scheduler.
|
||||
|
||||
Exit criterion: parallel-map and channel ownership-transfer examples.
|
||||
|
||||
## Phase 4 — Islands
|
||||
|
||||
Deliver:
|
||||
|
||||
- island allocator;
|
||||
- `iref<T>`;
|
||||
- closure verification;
|
||||
- move/transfer;
|
||||
- freeze;
|
||||
- `Frozen<T>`.
|
||||
|
||||
Exit criterion: cyclic graph can move between tasks with no deep copy and no shared mutation.
|
||||
|
||||
## Phase 5 — Atomics and memory model
|
||||
|
||||
Deliver:
|
||||
|
||||
- atomic scalar types;
|
||||
- all five orderings;
|
||||
- fences;
|
||||
- happens-before model in interpreter/testing tools;
|
||||
- weak-atomic audit marking;
|
||||
- schedule exploration.
|
||||
|
||||
Exit criterion: atomic publication litmus/conformance tests.
|
||||
|
||||
## Phase 6 — Source language
|
||||
|
||||
Deliver:
|
||||
|
||||
- source parser;
|
||||
- source-to-AIR lowering;
|
||||
- generics/monomorphization;
|
||||
- contracts syntax;
|
||||
- formatter.
|
||||
|
||||
Exit criterion: all reference programs authored primarily as `.aji`.
|
||||
|
||||
## Phase 7 — Native backend
|
||||
|
||||
Deliver:
|
||||
|
||||
- LLVM lowering;
|
||||
- Linux x86_64;
|
||||
- Linux aarch64;
|
||||
- macOS aarch64;
|
||||
- ABI tests.
|
||||
|
||||
Exit criterion: interpreted and native executions pass the same conformance corpus.
|
||||
|
||||
## Phase 8 — Agent protocol
|
||||
|
||||
Deliver:
|
||||
|
||||
- `ajid`;
|
||||
- structured diagnostics;
|
||||
- inspect/trace endpoints;
|
||||
- machine-readable verifier state summaries;
|
||||
- benchmark protocol.
|
||||
|
||||
Exit criterion: an external coding agent can implement/repair a reference task using only the protocol and repository spec.
|
||||
@@ -0,0 +1,112 @@
|
||||
# Conformance Suite
|
||||
|
||||
## Reference programs
|
||||
|
||||
### 1. hello
|
||||
|
||||
Tests compiler/interpreter/runtime bootstrap.
|
||||
|
||||
### 2. file-copy
|
||||
|
||||
Tests:
|
||||
|
||||
- file resources;
|
||||
- regions;
|
||||
- slices;
|
||||
- fallible I/O;
|
||||
- cleanup paths.
|
||||
|
||||
### 3. tcp-echo
|
||||
|
||||
Tests:
|
||||
|
||||
- socket typestate;
|
||||
- tasks;
|
||||
- cancellation;
|
||||
- resource transfer.
|
||||
|
||||
### 4. append-log
|
||||
|
||||
Tests:
|
||||
|
||||
- checksums;
|
||||
- bounded memory;
|
||||
- crash/recovery behavior;
|
||||
- explicit fsync;
|
||||
- serialization;
|
||||
- resource safety.
|
||||
|
||||
### 5. parallel-map
|
||||
|
||||
Tests:
|
||||
|
||||
- slice partition proof;
|
||||
- scoped mutable borrows;
|
||||
- task join;
|
||||
- cancellation.
|
||||
|
||||
### 6. island-pipeline
|
||||
|
||||
Tests:
|
||||
|
||||
- cyclic mutable graph;
|
||||
- channel transfer;
|
||||
- sender invalidation;
|
||||
- receiver ownership;
|
||||
- freeze and concurrent reads.
|
||||
|
||||
## Negative verifier corpus
|
||||
|
||||
Must include:
|
||||
|
||||
- use after move;
|
||||
- overlapping mutable borrows;
|
||||
- region reset with live reference;
|
||||
- use of prior region generation;
|
||||
- island internal reference escape;
|
||||
- non-Send transfer;
|
||||
- non-Share concurrent read;
|
||||
- task escape;
|
||||
- async buffer use while in flight;
|
||||
- invalid atomic ordering;
|
||||
- missing capability;
|
||||
- undeclared effect;
|
||||
- linear resource leak.
|
||||
|
||||
## Concurrency stress modes
|
||||
|
||||
Run concurrency tests with:
|
||||
|
||||
```text
|
||||
1 worker
|
||||
2 workers
|
||||
N workers
|
||||
deterministic schedule
|
||||
randomized schedule
|
||||
forced yield at synchronization points
|
||||
slow consumer
|
||||
cancellation during waits
|
||||
I/O completion reordering
|
||||
```
|
||||
|
||||
## Agent benchmark
|
||||
|
||||
Compare Aji, Zig, Rust and C under the same task specifications and agent model.
|
||||
|
||||
Primary metric:
|
||||
|
||||
```text
|
||||
P(correct program | one generation/repair iteration)
|
||||
```
|
||||
|
||||
Secondary metrics:
|
||||
|
||||
- iterations to verified solution;
|
||||
- tokens consumed;
|
||||
- verifier/compiler repair loops;
|
||||
- runtime defects;
|
||||
- memory/concurrency bugs;
|
||||
- regression rate after change;
|
||||
- context required to modify the system;
|
||||
- runtime speed;
|
||||
- binary size.
|
||||
@@ -0,0 +1,25 @@
|
||||
# Phase 0 — Semantic skeleton: task breakdown
|
||||
|
||||
Non-normative. Breaks Phase 0 of [`README.md`](README.md) into tasks small enough for one agent session each.
|
||||
|
||||
Exit criterion (from the plan): AIR `hello` and arithmetic tests execute identically across runs.
|
||||
|
||||
| ID | Task | Depends on | Output | Done when |
|
||||
|---|---|---|---|---|
|
||||
| P0-1 | Specify text AIR grammar | — | `docs/reference/air-text.ebnf`, updates to `docs/spec/07-air.md` | grammar covers module header, functions, `effects`, blocks with parameters, instructions, comments; seed tests in `tests/conformance/phase0` match it |
|
||||
| P0-2 | AIR data model | P0-1 | `src/air.zig` (types, values, instructions, blocks, functions, module) | round-trips through P0-4 |
|
||||
| P0-3 | Text AIR lexer + parser | P0-1, P0-2 | `src/air/parse.zig` | parse errors are diagnostics with spans; new parse codes registered in `error-codes.md` |
|
||||
| P0-4 | Canonical serializer | P0-2 | `src/air/print.zig` | `parse ∘ print` is identity on the data model; output is byte-stable |
|
||||
| P0-5 | CFG verifier | P0-3 | `src/verifier/cfg.zig` | `E5002` accept/reject tests pass |
|
||||
| P0-6 | SSA/dominance verifier | P0-5 | `src/verifier/ssa.zig` | `E5001` accept/reject tests pass |
|
||||
| P0-7 | Type verifier for integer ops, structs, enums | P0-3 | `src/verifier/types.zig` | `E1001` accept/reject tests pass |
|
||||
| P0-8 | Verifier resource budget | P0-5 | budget in `src/verifier.zig` | `E5101` emitted deterministically; budget documented in spec 08 |
|
||||
| P0-9 | Interpreter core | P0-6, P0-7 | `src/interp.zig` | arithmetic programs run; checked overflow traps per spec |
|
||||
| P0-10 | `aji run` + run tests in conformance runner | P0-9 | `expect: run` header with expected stdout/trap | `hello` and arithmetic tests pass, output identical across 100 runs |
|
||||
|
||||
## Open questions to resolve in P0-1
|
||||
|
||||
- Comment syntax in text AIR (the conformance runner currently strips leading `;` lines itself).
|
||||
- Spelling of constants (`const.u64 0` is provisional) and comparison results (`bool` vs `u1`).
|
||||
- How `hello` reaches stdout before Phase 2 capabilities exist: a test-only intrinsic, or Phase 2 `io.write` brought forward.
|
||||
- Whether parse errors get their own `E0xxx` range or join `E5xxx`.
|
||||
Reference in new issue
Block a user