Getting started meant cloning the repository, bootstrapping a compiler and
learning a task runner called `x`. That is a contributor's workflow handed to
everyone who wants to try the language.
Installing is now one command:
curl -fsSL https://workshopsoft.pages.workshopsoft.io/ludic/install.sh | sh
install.sh puts a complete toolchain — compiler, CLI, engine runtime, bundled
ludic.* packages, formatter, language server — in ~/.ludic and adds it to PATH.
Prebuilt artifacts are checksum-verified; where a platform has none, or the
release predates this layout, it bootstraps from the compiler's own IR seed with
clang. The docs site publishes the script beside the pages that quote it, so the
page and the script can never come from different releases.
`x` becomes `ludic`, and the surface splits by audience. A user of the language
sees `new`, `run`, `build`, `test`, `add`, `fmt`, `lsp`, `doctor`, `upgrade`;
`ludic new` scaffolds a project that builds and plays as it stands. Everything
the toolchain repo needs moved under `ludic dev` — build, test, reseed,
bootstrap-cfree, docs-gen, release — unchanged apart from the namespace. Those
tasks read arguments one position further along, so dispatch_dev sets a shift
and commands use arg_n()/arg_total() rather than each knowing its own depth.
Release artifacts become complete install roots (bin/ beside runtime/, packages/
and VERSION) rather than bare binaries, which is what the installer unpacks.
`ludic dev test` asserts the whole shape: it stages an install, puts it on PATH
with no LUDIC_HOME, and runs new -> build -> test through it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
38 lines
1.5 KiB
Text
38 lines
1.5 KiB
Text
# reason.ludic — LC1 reason-carrying teardown. One @OnDespawn hook, but it knows
|
|
# *why* the entity is ending: `reason: r` binds an EndReason the compiler passes
|
|
# at each teardown site. An in-world `despawn` passes EndReason.Despawned; program
|
|
# shutdown passes EndReason.Quit (every still-live entity's hook fires at exit — no
|
|
# silent deaths). The body branches on the reason, exactly as Unreal's
|
|
# EndPlay(reason) / Erlang's terminate(Reason) do.
|
|
#
|
|
# Running it prints: 503 1009
|
|
# 503 Enemy A despawned in-world (Despawned): drop its loot, 3 + 500
|
|
# 1009 Enemy B outlived the run; at quit (Quit) it skips loot, 9 + 1000
|
|
#
|
|
# bin/ludic dev game-build bin/ludicc examples/lang/reason.ludic /tmp/reason
|
|
# /tmp/reason </dev/null
|
|
program Reasons {
|
|
property Health { hp: int = 0 }
|
|
property Loot { gold: int = 0 }
|
|
model Enemy { Health, Loot }
|
|
|
|
@OnDespawn(Enemy, reason: r) handler Clean {
|
|
match r {
|
|
EndReason.Quit => { print(Health.hp + 1000) } # app closing — don't bother dropping loot
|
|
_ => { print(Loot.gold + 500) } # died in-world — drop the loot
|
|
}
|
|
}
|
|
|
|
handler Seed phase Start {
|
|
spawn Enemy { Health { hp: 7 }, Loot { gold: 3 } } # A
|
|
spawn Enemy { Health { hp: 9 }, Loot { gold: 4 } } # B
|
|
}
|
|
|
|
handler Run phase Render {
|
|
var first = 0
|
|
for (e) in query [Health] {
|
|
if first == 0 { despawn self(); first = 1 } # despawn A -> Despawned -> 3 + 500 = 503
|
|
}
|
|
quit() # B survives -> Quit -> 9 + 1000 = 1009
|
|
}
|
|
}
|