ludic syntax, and ludic-dev syntax: every grammar written from the compiler's vocabulary and checked against it

`ludic syntax [--json] [-o FILE]` prints what `ludicc --emit-syntax` does (a line
per entry, or the JSON). `ludic-dev syntax` writes, between "ludic-dev syntax:
begin" / "end" lines, the keyword, type, phase and attribute tables of
ludic_syntax.h, LudicVocabulary's sets (JetBrains), ludic-mode.el's lists and the
language server's word tests (is_keyword_word and the rest; is_contextual_word is
every word the parser does not reserve, and every declaring or modifying one),
and every TextMate pattern marked "comment": "ludic-dev syntax: <group>" (shared
and the VS Code copy). The grammars gain module uses port bind action reducer
dispatch registry def open component prop view alias friend unsafe numbers of as
from mut system; import and extern colour as declarations; the phase clause
knows Overlay; the bitwise pattern matches | and ^ on their own again.

`ludic-dev syntax --check` - and check-vocabulary, whose old parser comparison it
replaces, and the regression suite (syntax_cases, one line per file) - fails when
a written list is behind, when a grammar lacks a keyword, type or phase, when
docs/language has no page for a keyword, type, phase or attribute, or when the
parser (a scan of selfhost/frontend: is_id / text == words, a == / ann ==
attributes) tests a word or reads an attribute vocab.ludic lacks, or the reverse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 23:59:30 +03:00
parent 73f7d0b7a3
commit 2ad6edaae3
15 changed files with 784 additions and 118 deletions

View file

@ -2246,6 +2246,7 @@ ludic test packages/ludic.base # the test programs under a directory (a
ludic build --check # every check a build makes, nothing written
ludic build --check --diagnostics=json # the same, every error as a JSON array on stdout
ludic schema -o build/schema.json # records, registries, entries, consts, components and natives, for editors
ludic syntax --json # the language's vocabulary: keywords, declarations, types, phases, attributes, operators
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)
@ -2361,6 +2362,16 @@ Plugins for VS Code and JetBrains IDEs, plus configuration for Neovim, Helix,
Emacs, Sublime and Zed, are in `tools/editors/` — see
[tools/editors/README.md](tools/editors/README.md).
The vocabulary every editor highlights with is the compiler's: `ludic syntax
--json` (`ludicc --emit-syntax`) prints every keyword with its role and whether
the parser reserves it, every declaration's form, the built-in types and phases,
every attribute with what it goes on, its arguments and what it means, the
operators and the literal forms. The grammars in `tools/editors/`, the language
server's word lists and `ludic_syntax.h` are written from it between marked lines
(`bin/ludic-dev syntax`), and `bin/ludic-dev syntax --check` fails when one falls
behind, when docs/language lacks a page for an entry, or when the parser tests a
word the vocabulary does not have.
## Working programs
- `examples/games/chronorift.ludic` — a co-op JRPG (overworld, dungeon, boss, shop,