fix(lang): the action drain is the program's; --check runs every check a build makes; a registry key named count is refused; name lookups are tables

- the function that calls every reducer (and the action queue) is written in the program's own
  file: in the first action's file it belonged to that module, depended on every module with a
  reducer, and joined a game's modules into one 69-module cycle (examples/actions/modules and a
  ludic deps case hold it); the state instances, the queue and the reducers make no deps edges
- ludicc --check / ludic build --check lower the program too and write nothing, so the code
  writer's refusals are in it: a bind to a function that is gone, an unknown name (and the checker
  now refuses fn <missing> itself); rejects bind_missing_fn, unknown_name, registry_count_key
- def R count is refused: its constant would be PREFIX_COUNT, the registry's size
- a file's module, package, trust and numbers-float are tables, and from the check on the lookups
  of functions, enums, records, globals and externs are too (tagged enums kept as a list): Maroon
  Lake's check-only build went from about 20 s to 7 s including lowering, its IR from about 2
  minutes to under 10 s; duplicate declarations are found by table, not a pair of loops
- threads.ludic's pool check gives each call a little work, so a busy machine cannot run them all
  on the caller before a worker wakes (it failed one run in three under load)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 23:34:34 +03:00
parent 2fdefa6040
commit 8cf4b3fed6
24 changed files with 67169 additions and 64398 deletions

View file

@ -2025,7 +2025,7 @@ ludic test # compile and run the project's `test`
ludic test tests/math.ludic --test adds # just the test named "adds" (-v: every result line)
ludic test -j 4 # four tests at once (default: one per CPU)
ludic test packages/ludic.base # the test programs under a directory (a package's)
ludic build --check # only check: types, modules, uses and ports - nothing emitted
ludic build --check # every check a build makes, nothing written
ludic deps # how tangled the modules are, as the compiler resolved them
ludic deps --check tests/deps-baseline.txt # fail when a number rose (--baseline FILE writes them)
@ -2033,11 +2033,11 @@ ludicc app.ludic -o build/app # the compiler directly: a native binar
ludicc app.ludic --emit-llvm -o app.ll # stop at LLVM IR
```
`ludic build [file] --check` (the compiler's `ludicc --check`) runs everything the compiler checks
before it writes code - the parse, the types, `export`, `uses` and layers, ports and binds, registries
- and stops: no IR, no link. On Maroon Lake it takes about three seconds where a build takes about a
minute, for iterating on `uses` lines. Two checks belong to the code writer and only a build makes
them: a function that can reach its end without its result, and a local declared twice in a block.
`ludic build [file] --check` (the compiler's `ludicc --check`) runs every check a build makes - the
parse, the types, `export`, `uses` and layers, ports and binds, registries, and the code writer's own
(a function that can reach its end without its result, a bind to a function that is not there, an
unknown name) - and writes nothing: no IR, no link. On Maroon Lake it takes about four seconds, for
iterating on `uses` lines.
`ludic deps` compiles the program (the package's entry, or a file) with the compiler recording every
reference its visibility pass resolves - from the module it is written in to the module of what it