72e54f4fd3
The surface-form file extension changes from .ailx to .ail. AILang's
authoring surface now uses the same .ail stem as its canonical JSON
form (.ail.json), giving the language a single coherent extension
family: .ail is the LLM-authored Form A, .ail.json is the canonical
JSON-AST Form B.
Scope (touched):
- 61 example renames examples/**/*.ailx → .ail (git mv)
- 1 rename experiments/.../rendered/ailx.md → ail.md
- 35 content-edited live-toolchain files (crates/, docs/DESIGN.md,
docs/roadmap.md, docs/PROSE_ROUNDTRIP.md, skills/, bench/reference/*.c,
experiment crates under experiments/.../{render,harness,master})
- Experiment-crate cohort rename Cohort::Ailx → Cohort::Ail,
Form::Ailx → Form::Ail, per_cohort/ailx → per_cohort/ail,
{form-only: ailx} → {form-only: ail}, ```ailx → ```ail
Out of scope (deliberately untouched, to preserve honest history):
- docs/journal-archive.md (content-frozen per CLAUDE.md)
- docs/journals/, docs/specs/, docs/plans/, bench/orchestrator-stats/
- experiments/.../runs/ (frozen LLM-output artefacts; models actually
saw .ailx — renaming would falsify the experimental record)
Verification: cargo build/test --workspace green; experiment crate
cargo test green; bench/check.py + compile_check.py + cross_lang.py
all 0-regressed; negative grep for ailx|Ailx|AILX outside the
out-of-scope paths returns zero matches.
Opens immediate follow-up: roadmap.md P2 todo `ail check`/build/run
accept .ail extension — after this rename, .ail is canonical
authoring surface but the CLI still produces a misleading JSON-parse
error on `ail check foo.ail`. That's the next iter.
65 lines
2.1 KiB
Plaintext
65 lines
2.1 KiB
Plaintext
; Iter 18d.1 — `(reuse-as xs (term-ctor List Cons ...))` schema floor
|
|
; demo. The `(reuse-as ...)` wrapper is identity at codegen in 18d.1
|
|
; (the `body` is lowered, the `source` is dropped); 18d.2 will lower
|
|
; this as in-place rewrite under `--alloc=rc`.
|
|
;
|
|
; The fixture exercises:
|
|
; - parser + printer round-trip for `Term::ReuseAs`
|
|
; - typecheck of an all-explicit-mode fn whose body returns a
|
|
; `(reuse-as <var> <ctor>)` form (body is allocating: Term::Ctor)
|
|
; - linearity check: `xs` is consumed exactly once via reuse-as in
|
|
; the Cons arm; the Nil arm doesn't consume `xs`. Merge across
|
|
; arms is consistent.
|
|
; - codegen identity under --alloc=gc: program prints `9`
|
|
; (1+1 + 2+1 + 3+1 = 9), the same value the non-reuse-as
|
|
; `map_inc` would print.
|
|
;
|
|
; Expected stdout under --alloc=gc:
|
|
; 9
|
|
|
|
(module reuse_as_demo
|
|
|
|
(data List
|
|
(doc "Monomorphic singly-linked Int list — boxed, recursive.")
|
|
(ctor Nil)
|
|
(ctor Cons (con Int) (con List)))
|
|
|
|
(fn map_inc
|
|
(doc "Increment each Int in xs. The Cons arm uses (reuse-as xs ...) — author asserts that the freshly-allocated Cons cell should reuse xs's slot. In 18d.1 codegen treats this as identity.")
|
|
(type
|
|
(fn-type
|
|
(params (own (con List)))
|
|
(ret (own (con List)))))
|
|
(params xs)
|
|
(body
|
|
(match xs
|
|
(case (pat-ctor Nil) (term-ctor List Nil))
|
|
(case (pat-ctor Cons h t)
|
|
(reuse-as xs
|
|
(term-ctor List Cons (app + h 1) (app map_inc t)))))))
|
|
|
|
(fn sum_list
|
|
(doc "Consume xs, sum its elements.")
|
|
(type
|
|
(fn-type
|
|
(params (own (con List)))
|
|
(ret (con Int))))
|
|
(params xs)
|
|
(body
|
|
(match xs
|
|
(case (pat-ctor Nil) 0)
|
|
(case (pat-ctor Cons h t)
|
|
(app + h (app sum_list t))))))
|
|
|
|
(fn main
|
|
(doc "Build [1,2,3]; map_inc → [2,3,4]; sum_list → 9. Print 9.")
|
|
(type (fn-type (params) (ret (con Unit)) (effects IO)))
|
|
(params)
|
|
(body
|
|
(let xs
|
|
(term-ctor List Cons 1
|
|
(term-ctor List Cons 2
|
|
(term-ctor List Cons 3
|
|
(term-ctor List Nil))))
|
|
(do io/print_int (app sum_list (app map_inc xs)))))))
|