Phase 3a: spawn/record initializers use ':' (Rule A)
Comp = { f = v } -> Comp { f: v }. record() requires ':' and parse_spawn()
drops the '=' before the record; '=' is now assignment/binding only. Records
appear only in games, so the compiler seed is unaffected.
Migration: tools/ludic-tools/migrate_records.c (spawn-context aware). Verified
every golden byte-identical, old '=' form rejected, reseeded, test.sh 14/14.
Docs updated (LANGUAGE.md, BOOTSTRAP.md R2).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
eac8f8f335
commit
39bd430ce8
12 changed files with 2499 additions and 2425 deletions
|
|
@ -16,14 +16,14 @@ system Boot phase Start {
|
|||
|
||||
build_field(0)
|
||||
spawn Player {
|
||||
Pos = { x = 11, y = 15 }
|
||||
Actor = { kind = 5 }
|
||||
Party = { slot = 0 }
|
||||
Stats = { hp = 40, maxhp = 40, mp = 8, maxmp = 8, atk = 12, def = 6, lvl = 1, xp = 0, guard = 0 }
|
||||
Pos { x: 11, y: 15 }
|
||||
Actor { kind: 5 }
|
||||
Party { slot: 0 }
|
||||
Stats { hp: 40, maxhp: 40, mp: 8, maxmp: 8, atk: 12, def: 6, lvl: 1, xp: 0, guard: 0 }
|
||||
}
|
||||
spawn Ally {
|
||||
Party = { slot = 1 }
|
||||
Stats = { hp = 26, maxhp = 26, mp = 16, maxmp = 16, atk = 8, def = 4, lvl = 1, xp = 0, guard = 0 }
|
||||
Party { slot: 1 }
|
||||
Stats { hp: 26, maxhp: 26, mp: 16, maxmp: 16, atk: 8, def: 4, lvl: 1, xp: 0, guard: 0 }
|
||||
}
|
||||
setreg(R_MODE, 0)
|
||||
setreg(R_ENC, 4)
|
||||
|
|
@ -69,8 +69,8 @@ system Control phase Input {
|
|||
if reg(R_BOSS) == 0 {
|
||||
setreg(R_ETYPE, 2)
|
||||
spawn Enemy {
|
||||
Actor = { kind = 8 }
|
||||
Stats = { hp = 120, maxhp = 120, mp = 0, maxmp = 0, atk = 18, def = 10, lvl = 5, xp = 300, guard = 0 }
|
||||
Actor { kind: 8 }
|
||||
Stats { hp: 120, maxhp: 120, mp: 0, maxmp: 0, atk: 18, def: 10, lvl: 5, xp: 300, guard: 0 }
|
||||
}
|
||||
setreg(R_MODE, 1)
|
||||
setreg(R_PHASE, 0)
|
||||
|
|
@ -96,14 +96,14 @@ system Control phase Input {
|
|||
setreg(R_ETYPE, et)
|
||||
if et == 0 {
|
||||
spawn Enemy {
|
||||
Actor = { kind = 6 }
|
||||
Stats = { hp = 18, maxhp = 18, mp = 0, maxmp = 0, atk = 8, def = 2, lvl = 1, xp = 7, guard = 0 }
|
||||
Actor { kind: 6 }
|
||||
Stats { hp: 18, maxhp: 18, mp: 0, maxmp: 0, atk: 8, def: 2, lvl: 1, xp: 7, guard: 0 }
|
||||
}
|
||||
}
|
||||
if et == 1 {
|
||||
spawn Enemy {
|
||||
Actor = { kind = 7 }
|
||||
Stats = { hp = 30, maxhp = 30, mp = 0, maxmp = 0, atk = 11, def = 5, lvl = 1, xp = 15, guard = 0 }
|
||||
Actor { kind: 7 }
|
||||
Stats { hp: 30, maxhp: 30, mp: 0, maxmp: 0, atk: 11, def: 5, lvl: 1, xp: 15, guard: 0 }
|
||||
}
|
||||
}
|
||||
setreg(R_MODE, 1)
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ game Hello {
|
|||
|
||||
system Boot phase Start {
|
||||
spawn Mob {
|
||||
Pos = { x = 3, y = 4 }
|
||||
Vel = { dx = 1, dy = 0 }
|
||||
Pos { x: 3, y: 4 }
|
||||
Vel { dx: 1, dy: 0 }
|
||||
}
|
||||
spawn Mob {
|
||||
Pos = { x = 10, y = 2 }
|
||||
Vel = { dx = 0, dy = 1 }
|
||||
Pos { x: 10, y: 2 }
|
||||
Vel { dx: 0, dy: 1 }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ game Arena {
|
|||
component Fighter { hp: int = 30, attack: int = 9, armour: int = 2 }
|
||||
|
||||
system Boot phase Start {
|
||||
spawn Hero { Fighter = { hp = 40, attack = 12, armour = 3 } }
|
||||
spawn Orc { Fighter = { hp = 24, attack = 7, armour = 1 } }
|
||||
spawn Hero { Fighter { hp: 40, attack: 12, armour: 3 } }
|
||||
spawn Orc { Fighter { hp: 24, attack: 7, armour: 1 } }
|
||||
}
|
||||
|
||||
system Fight phase Update {
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ game QueryDecl {
|
|||
archetype Foe { Battle, Pos }
|
||||
|
||||
system Seed phase Start {
|
||||
spawn Foe { Battle = { hp = 3, side = 1 } }
|
||||
spawn Foe { Battle = { hp = 0, side = 1 } }
|
||||
spawn Foe { Battle = { hp = -2, side = 0 } }
|
||||
spawn Foe { Battle { hp: 3, side: 1 } }
|
||||
spawn Foe { Battle { hp: 0, side: 1 } }
|
||||
spawn Foe { Battle { hp: -2, side: 0 } }
|
||||
}
|
||||
|
||||
system CleanBattle phase LateUpdate
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -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