ludic/docs/language/annotations
Orkuncakilkaya e4265f5fdb feat(lang): 27.1 - a state machine as data: @Machine(Record.field) on a registry of transitions
A registry marked `@Machine(Deer.mood)` is the transitions of a machine over that enum field of the
records a state's Table<Deer> holds. Its record has from and to (the enum's variants), on: string (an
action's name, "" for a transition the tick asks), guard: fn(Row<Deer>, reads...) -> bool and
enter: fn(Row<Deer>, reads...) -> void; the states are the enum's variants and the start is the
field's default. The rows are data (an .lres or defs), the names the studio already edits.

Written by the compiler (machines.ludic, machines_write.ludic): for each action an `on` names, a row
reducer in the registry's file (named ..__machine__DeerSteps, so it sits beside the program's own
row reducer on the same action, after it): the row's state, the first transition from it on that
action whose guard passes, the field set, enter run - guards and enters called by name. When a row
leaves a state on a guard alone, `state DeerStepsMachine` (the kept row view) and
deer_steps_tick(m: mut DeerStepsMachine, s: mut Herd, reads...), one transition a row a tick.
Nothing allocates.

The table is the whole machine: the field written anywhere else - an assignment, or a `machine`
block's become over it - is a type error (check_stmt.ludic, ck_machine_write). Guards and enters take
the row first, are the record's module's, keep a row reducer's rules (and may be handed the row);
a guard writes nothing through it. The graph is checked, each error at its row (in the .lres when
the rows are there): a state never reached from the start, a state with no way out, an `on` naming
no action or an action with no @Target, a self-transition with no guard, two ways out of a state on
one trigger behind an unguarded first. Also refused: @Machine off a registry, a field that is not a
plain enum with a default, a @Column field, no table (or two) of the record, a transitions record of
another shape, a machine outside its table's state's module.

ludic schema's code section gains `machines` (registry, record, field, enum, table, start, states,
actions, tick, module, at); ludic deps names a machine's reducer `reducer Deer in Herd.deer on Spook
(machine DeerSteps)`. vocab @Machine; docs annot-machine, kw-machine; LANGUAGE.md "A machine as
data"; examples actions/machine (+ deer_steps.lres) and ten rejects; test.ludic feat, reject and
schema cases (not run); changes/machines.md. Reseeded; bootstrap-cfree fixpoint holds (317642
lines); Maroon Lake's `ludic build --check` is clean against this tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 16:37:37 +03:00
..
_section.md docs: add Networking section + process/OS builtins (net_send, owner, is_server, serialize/apply, arg, exit, run, getenv, read_char, file_*) 2026-08-29 16:39:29 +03:00
annot-alloc_ok.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-appendonly.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-asset.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-clearcolor.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-color.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-column.md feat(lang): 27.3 - a reducer on a table's row: reducer T in S.table on A, @Target, Row<T>, @RowVerb, @Column 2026-09-30 16:14:59 +03:00
annot-computed.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-derived.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-deterministic.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-enginesystem.md docs(pkg): document @Namespace / @EngineSystem / @System + package hooks (#62) 2026-09-01 12:31:47 +03:00
annot-export.md docs(0.S): the doc fences migrated by ludic migrate state; LANGUAGE.md's state section says what the tool and the checker do now; no module-level var left in the docs 2026-09-25 15:37:29 +03:00
annot-frame.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-handles.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-key.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-machine.md feat(lang): 27.1 - a state machine as data: @Machine(Record.field) on a registry of transitions 2026-09-30 16:37:37 +03:00
annot-max.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-namespace.md docs(pkg): document @Namespace / @EngineSystem / @System + package hooks (#62) 2026-09-01 12:31:47 +03:00
annot-node.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-on.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-onattach.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-ondespawn.md feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
annot-ondetach.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-ondisable.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-onenable.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-oneof.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-onquit.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-onspawn.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-onstart.md docs(0.S): the doc fences migrated by ludic migrate state; LANGUAGE.md's state section says what the tool and the checker do now; no module-level var left in the docs 2026-09-25 15:37:29 +03:00
annot-owned.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-owns.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-permap.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-predicted.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-public.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-queries.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-range.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-reads.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-ref.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-rowverb.md feat(lang): 27.3 - a reducer on a table's row: reducer T in S.table on A, @Target, Row<T>, @RowVerb, @Column 2026-09-30 16:14:59 +03:00
annot-server.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-sync.md feat(compiler): list literals, typed compound assignment, file:line diagnostics 2026-09-05 01:12:16 +03:00
annot-system.md docs(pkg): document @Namespace / @EngineSystem / @System + package hooks (#62) 2026-09-01 12:31:47 +03:00
annot-target.md feat(lang): 27.3 - a reducer on a table's row: reducer T in S.table on A, @Target, Row<T>, @RowVerb, @Column 2026-09-30 16:14:59 +03:00
annot-text.md Merge lang/i18nkeys (27024de) into lang/syntax: the vocabulary gains the text keys - the Key type, @TextKey (a registry's), the k"..." and kn"..." literals - and @Text's doc; docs/language pages for Key and @TextKey; ludic-dev syntax rewrote the grammars; reseeded, bootstrap-cfree fixpoint holds 2026-09-30 00:02:48 +03:00
annot-textkey.md Merge lang/i18nkeys (27024de) into lang/syntax: the vocabulary gains the text keys - the Key type, @TextKey (a registry's), the k"..." and kn"..." literals - and @Text's doc; docs/language pages for Key and @TextKey; ludic-dev syntax rewrote the grammars; reseeded, bootstrap-cfree fixpoint holds 2026-09-30 00:02:48 +03:00
annot-tint.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-toclients.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-toserver.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
annot-unit.md docs/language: a page for every keyword and attribute the vocabulary has 2026-09-29 23:59:47 +03:00
annot-writes.md docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00