| Field | Value |
|---|---|
Language |
AffineScript |
Repository |
|
Current TRG Grade |
E (X | F | E | D | C | B | A) |
Assessed |
2026-05-28 |
Assessor |
Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
TRG Spec Version |
1.0 |
ARG Profile |
spec/ARG-PROFILE.adoc |
FRG Profile |
spec/FRG-PROFILE.adoc |
CRG Profile |
spec/CRG-PROFILE.adoc |
This profile applies the TRG v1.0 baseline to AffineScript. The
working toolchain is substantial — OCaml/Menhir compiler with ~23
backends, REPL, LSP subset, ~309 end-to-end test cases, sublanguage
toolchain affinescriptiser, integration crates (affinescript-runtime,
affinescript-vite, @affinescript/pixijs) — but several MUST
components per TRG §3 are absent or undocumented as canonical
artefacts, which gates the overall grade at E. Specifically:
-
M5 operational/denotational semantics document is scattered across TECH-DEBT.adoc + CAPABILITY-MATRIX.adoc with no canonical file.
-
B1 intermediate representation is implicit (AST lowering to WASM bytecode); no documented IR-format SoT with invariants.
-
T4 formatter exists as a stubbed
formatter.mlwith the.mlidisabled — not production-ready. -
T9 pipeline orchestrator runs implicitly through dune build rules; no discrete orchestrator artefact.
The chain of axes:
-
ARG: D (pragmatic — working compiler, narrow adopter base)
-
TRG: E (this profile)
-
FRG: E (no mechanised proofs; design rationale documented)
-
CRG: D (per spec/CRG-PROFILE.adoc; no released v1.0 components)
-
RSR: assessed elsewhere
Cross-axis rule: ARG ≤ TRG holds (TRG = E ⇒ ARG ≤ E; current ARG-D is over the floor and is sustainable until grade C is sought — ARG-C would require TRG ≥ C per ARG §1.1).
The toolchain decomposes into components drawn from TRG §3. Each component is graded independently against the four-tier audit format of TRG §4 (Must / Should / Could / Aspirational → grades E / D / C / B). The overall TRG grade is the worst of any MUST component.
| # | Component | Grade | Evidence |
|---|---|---|---|
F1 |
Grammar / Syntax |
D |
|
F2 |
Lexer / Tokeniser |
C |
|
F3 |
Parser |
C |
Menhir-generated from |
F4 |
AST |
C |
|
F5 |
Macro expander |
N/A |
AffineScript has no macros. |
F6 |
Import resolver / Modules |
D |
|
F7 |
Diagnostics / Errors |
C |
|
| # | Component | Grade | Evidence |
|---|---|---|---|
M1 |
Semantic analyser |
C |
|
M2 |
Type checker |
C |
|
M3 |
Type-checker oracle |
N/A |
AffineScript is not a verified language (no proof obligations bound to a prover); see FRG-PROFILE.adoc. |
M4 |
Proof dispatcher |
N/A |
Same reason as M3. |
M5 |
Semantics document |
E |
Scattered across TECH-DEBT.adoc + CAPABILITY-MATRIX.adoc; no canonical semantics document. This is the load-bearing TRG-baseline gap. |
| # | Component | Grade | Evidence |
|---|---|---|---|
B1 |
Intermediate representation |
E |
Implicit lowering: AST → backend-specific output. No explicit IR with documented invariants. Gates the overall grade. |
B2 |
Code generator (per backend) |
D |
|
B3 |
Backend registry |
D |
|
B4 |
Linker / JIT / eval |
C |
|
B5 |
ABI / FFI surface |
D |
Multiple FFI modules: |
B6 |
Runtime |
D |
|
| # | Component | Grade | Evidence |
|---|---|---|---|
T1 |
Compiler driver |
C |
|
T2 |
Interpreter |
C |
|
T3 |
REPL |
D |
|
T4 |
Formatter |
X |
|
T5 |
LSP server |
D |
|
T6 |
Debugger |
N/A |
Absent. SHOULD per TRG §3.4; not blocking grade E. |
T7 |
Package manager |
D |
No bespoke package manager; relies on opam (OCaml), npm ( |
T8 |
Standard library |
C |
|
T9 |
Pipeline orchestrator |
D |
Implicit via dune + Justfile recipes; no discrete pipeline-orchestrator artefact. |
TRG §1.1 permits per-language tightening. For AffineScript, the following additional obligations apply at the stated grades:
-
Grade D tightening: Type checker MUST reject every test case in the borrow-check + affinity test fixtures (currently in
test/test_e2e.ml); regression on any rejection is a MUST-row failure. -
Grade C tightening: The 23-backend matrix MUST have a published conformance report listing pass/fail per backend per fixture; today only WASM has full coverage, with the others ranging D-X.
-
Grade B tightening: AffineScript MUST publish a paradigm conformance document showing borrow-check coverage of at least one canonical type-system surface (e.g. Rust’s NLL test corpus or equivalent).
These tightenings are additional to the baseline — none of the baseline evidence is waived.
N/A. AffineScript is not a verified language at the TRG-baseline level (see M3/M4 above). FRG = E reflects the same status. A future verified profile (e.g. AffineScript-Verified) would extend this section.
Gating gaps for grade D:
-
M5 canonical semantics document — operational and denotational semantics scattered across TECH-DEBT + CAPABILITY-MATRIX; no
docs/semantics.adoc. Required at baseline grade E. -
B1 explicit IR — no documented IR format with invariants. Implicit AST-direct-to-backend lowering. Required at baseline grade E.
-
T4 formatter —
formatter.mlstubbed; either complete the formatter or formally drop the SHOULD by declaring T4 absent with justification per TRG §3.
Gating gaps for grade C (assuming D is reached):
-
Backend conformance matrix not published.
-
No per-backend audit documents under
audits/audit-codegen-*.md. -
AST invariants not extracted into a separate doc.
-
No published proof-suite extension.
-
Write
docs/semantics.adocconsolidating the scattered semantics prose into one canonical operational + denotational document. (~1-2 weeks) -
Extract or document the implicit IR: name it (
AscIr?), describe its invariants, ship adocs/ir.adoc. (~1-2 weeks) -
Decide T4: either ship the formatter (~3-4 weeks) or document the absence per TRG §3.
Realistic timeline estimate: 4-6 weeks once prioritised.
-
Publish per-backend conformance report covering all 22+ codegen targets.
-
Author per-component audit documents under
audits/. -
Lift
test_e2e.mlfrom a monolithic test file into per-component audit-aligned test buckets. -
Achieve dogfooding: AffineScript MUST be used as the primary language for at least one downstream artefact (the existing
affinescript-vite+affinescript-pixijsqualifies, but needs AUDIT.adoc updates).
Realistic timeline estimate: 3-6 months from D.
-
Lowest: WASM backend regression flag flips to red, dropping B2 to X for the load-bearing backend.
-
Medium: Type-checker unsoundness found that the 309 e2e cases don’t catch, dropping M2 to D.
-
Catastrophic: Bidirectional H-M unification found to be unsound, dropping M2 to X and the toolchain to X.
| Date | Grade | Notes |
|---|---|---|
2026-05-28 |
E |
Initial TRG assessment per TRG v1.0. Gating items: M5 absent, B1 implicit, T4 stubbed. |
-
Routine: Reassess on every release cycle (per TRG §8).
-
Immediate: Reassess within 7 days of any MUST-component regression.
-
VeriSimDB drift alert: Reassess within 24 hours of any drift alert from VeriSimDB on this toolchain’s attestations.