Phase 2: enforce statement separators (Rule B)
The parser now requires a newline or ';' between statements (block() in selfhost/parse.ludic); two statements may no longer sit adjacent with only spaces. Also fixed if-without-else swallowing its trailing separator. Migration: tools/ludic-tools/migrate_separators.c inserts ';' at statement boundaries corpus-wide (examples, runtime, 25 self-host fragments, ~1100 boundaries). Verified semantically identical — the migrated compiler compiles itself to IR byte-identical to the pre-migration seed, and every golden game renders identically. Reseeded to the strict compiler; C-free fixpoint holds; test.sh 14/14. Docs: Rule B documented in LANGUAGE.md; BOOTSTRAP.md R1 + stale fences updated; check-docs green across all docs. Fixed a multi-line string literal in emit_expr.ludic (byte-identical \n escape) that the C toolchain lexer mis-lexes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
985f9ad8f2
commit
eac8f8f335
35 changed files with 3861 additions and 3588 deletions
|
|
@ -26,9 +26,9 @@ game Snake {
|
|||
|
||||
fn reset(x: int) -> int {
|
||||
for (p, s) in query [Pos, Seg] { despawn self() }
|
||||
spawn S0 { Seg = { order = 0 } Pos = { x = 10, y = 7 } }
|
||||
spawn S1 { Seg = { order = 1 } Pos = { x = 9, y = 7 } }
|
||||
spawn S2 { Seg = { order = 2 } Pos = { x = 8, y = 7 } }
|
||||
spawn S0 { Seg = { order = 0 }; Pos = { x = 10, y = 7 } }
|
||||
spawn S1 { Seg = { order = 1 }; Pos = { x = 9, y = 7 } }
|
||||
spawn S2 { Seg = { order = 2 }; Pos = { x = 8, y = 7 } }
|
||||
setreg(R_DIR, 3)
|
||||
setreg(R_LEN, 3)
|
||||
setreg(R_TICK, 0)
|
||||
|
|
@ -62,7 +62,7 @@ game Snake {
|
|||
setreg(R_TICK, 0)
|
||||
let len = reg(R_LEN)
|
||||
for (pt, stg) in query [Pos, Seg] {
|
||||
if stg.order == len - 1 { setreg(R_TX, pt.x) setreg(R_TY, pt.y) }
|
||||
if stg.order == len - 1 { setreg(R_TX, pt.x); setreg(R_TY, pt.y) }
|
||||
}
|
||||
for step in 0 .. len {
|
||||
let i = len - 1 - step
|
||||
|
|
@ -70,7 +70,7 @@ game Snake {
|
|||
for (pa, sa) in query [Pos, Seg] {
|
||||
if sa.order == i {
|
||||
for (pb, sb) in query [Pos, Seg] {
|
||||
if sb.order == i - 1 { pa.x = pb.x pa.y = pb.y }
|
||||
if sb.order == i - 1 { pa.x = pb.x; pa.y = pb.y }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ game Snake {
|
|||
}
|
||||
if reg(R_ATE) == 1 {
|
||||
setreg(R_SCORE, reg(R_SCORE) + 1)
|
||||
spawn Body { Seg = { order = len } Pos = { x = reg(R_TX), y = reg(R_TY) } }
|
||||
spawn Body { Seg = { order = len }; Pos = { x = reg(R_TX), y = reg(R_TY) } }
|
||||
setreg(R_LEN, len + 1)
|
||||
setreg(R_FX, rng_range(0, GW - 1))
|
||||
setreg(R_FY, rng_range(0, GH - 1))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue