● M3 is complete — just ci fully green. Here's what landed: #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "M3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
M3: Control, arithmetic, and indexing
Compiled control flow (codegen/lower.rs + body.rs): clause bodies now lower to a goal IR and compile to native
control —
stack
cut-to-height and fail
conditions, +, and once (a per-context cut-slot is threaded through compilation)
Builtins (background-agent port of v1's builtins.rs, 29 new runtime tests): full is/2 evaluable vocabulary,
comparisons, =/=/==/==/@-order/compare/3 — with error strings captured from the live v1 oracle and asserted
byte-for-byte (error(evaluation_error(zero_divisor), Division by zero (integer division)) etc.).
First-arg indexing: entry functions switch on the dereferenced first argument's tag/value to per-key clause
chains. Single-candidate dispatch pushes no choice point. The 5k-fact chain query went from ~10s (M2 linear
scan) to 3ms.
Query side: the runtime's minimal parser grew operator-precedence climbing + float literals, and a control
walker for runtime-built goals (walks goal terms only — never clauses; the v1 lesson holds). ./binary --query "X
is 2 + 3 * 4" works just like v1.
One finding worth your attention: the adversarial diff sweep exposed that v1 treats cut as opaque inside ; —
t(X) :- (m(X), X > 1, ! ; X = fallback) leaks fallback in v1, which violates ISO 7.8.4 (SWI/GNU give only X =
2). I chose ISO over bug-compatibility, documented it in ISO_COMPLIANCE.md under "Cut", and pinned both
behaviors' tests. Everything else in the sweep matches the oracle byte-for-byte, including linting.pl (which
needed +) end to end.
Verification: 71 runtime + 48 frontend + 14 M3-suite + 14 M2-suite + 11 golden-IR tests, cut-under-512KB-stack
recursion test, full just ci.