ludic/selfhost
Orkuncakilkaya e1537d2d45 feat(compiler): dynamic system registration + --emit-module for binary packages (#64)
The runtime + compiler foundation for prebuilt binary packages, over the
existing reflection C-ABI (EV0–EV8 already gives dynamic components via
ludic_register_prop).

- ludic_register_system(fn, phase) + a registry the frame loop dispatches after
  each phase's own handlers — the systems analogue of ludic_register_prop,
  mirroring the EV6 foreign event-listener array. Emitted for every ECS program;
  a zero-length registry means a non-hosting game is output-identical.
- --emit-module: compile a package to a position-independent module — no main,
  no world table — that declares the host reflection ABI it calls and carries a
  load-time constructor which registers its @System(Phase) functions and runs
  module_init (where it registers its dynamic components). Built as a dylib with
  -undefined dynamic_lookup, it binds ludic_* back to the host image at load.
- @System(Phase) annotation marks a module function as a runtime-registered
  system; the compiler supplies its address (Ludic source cannot take one).
- The reflection ABI (world table) is now emitted for every ECS program, so any
  game can host binary modules with no flag; unused defs dead-strip at -O2, so
  golden renders stay byte-identical and the C-free bootstrap fixpoint holds.

Proven end-to-end: a module dylib registers a component + an Update system; a
host game that never saw its source links it and the system mutates the shared
world each frame. Full suite 87/0, test-tools 30/0, fixpoint intact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-01 07:44:18 +03:00
..
backend feat(compiler): dynamic system registration + --emit-module for binary packages (#64) 2026-09-01 07:44:18 +03:00
frontend feat(compiler): dynamic system registration + --emit-module for binary packages (#64) 2026-09-01 07:44:18 +03:00
golden chore(repo): DX cleanup — categorise examples, text-diffable golden, build/ output (#27 #28 #30) 2026-08-30 18:54:21 +03:00
support refactor(selfhost): reorganise into concern-based subdirectories 2026-08-31 00:26:02 +03:00
tests feat(types): tagged-union enums — variant payloads + binding match + exhaustiveness (#56) 2026-09-01 03:07:46 +03:00
ludicc.seed.ll feat(compiler): dynamic system registration + --emit-module for binary packages (#64) 2026-09-01 07:44:18 +03:00
main.ludic feat(compiler): dynamic system registration + --emit-module for binary packages (#64) 2026-09-01 07:44:18 +03:00