Files
Brummel 72e54f4fd3 iter ext-rename: .ailx → .ail across the live toolchain
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.
2026-05-12 14:20:27 +02:00

69 lines
2.0 KiB
C

// Hand-C reference for bench_list_sum.
//
// Same algorithm as examples/bench_list_sum.ail — build a linked list
// of [0, 1, ..., N-1] via prepending, then sum by linear traversal.
// Three workload sizes: 100k / 1M / 3M cells, matching the AILang
// fixture exactly so the AILang/C wall-time ratio is fair.
//
// Cell layout: { long head; struct cell *tail; } — 16 bytes (8 head
// + 8 pointer). AILang's IntList ICons cell is wider (tag + payload +
// tail = 24 bytes) because the runtime carries a constructor tag for
// the discriminated-union. The 1.5x size difference is one of the
// real costs of the discriminated-union representation; quoting the
// raw ratio without naming this is the wrong comparison.
//
// Memory policy: this reference uses malloc and DELIBERATELY DOES
// NOT FREE. That matches AILang's bench_list_sum running under
// --alloc=rc with implicit-mode params (cells leak by design — the
// 18c.3 known debt). The fair comparison is therefore:
// AILang --alloc=rc (implicit-mode, leaks) vs. this C (leaks)
// A future iter that ships explicit-mode bench_list_sum + a free()-
// adding C variant would close the apples-to-apples gap on the
// dec-cost axis.
//
// Build: clang -O2 -o list_sum list_sum.c
// Expected stdout (one int per line):
// 4999950000
// 499999500000
// 4499998500000
#include <stdio.h>
#include <stdlib.h>
typedef struct cell {
long head;
struct cell *tail;
} cell_t;
static cell_t *cons_n(long n) {
cell_t *acc = NULL;
for (long i = n - 1; i >= 0; i--) {
cell_t *c = (cell_t *) malloc(sizeof(cell_t));
c->head = i;
c->tail = acc;
acc = c;
}
return acc;
}
static long sum_list(const cell_t *xs) {
long acc = 0;
while (xs) {
acc += xs->head;
xs = xs->tail;
}
return acc;
}
static void run_one(long n) {
const cell_t *xs = cons_n(n);
printf("%ld\n", sum_list(xs));
}
int main(void) {
run_one(100000);
run_one(1000000);
run_one(3000000);
return 0;
}