Expand description
The single source of truth for the language’s keywords.
Every keyword’s CAPS spelling lives exactly once, in kw. The KEYWORDS
table attaches each one’s role (may it begin a statement?) and its syntax card
(canonical form, one-line gloss, a copy-paste example). Everything else in the
workspace that needs to know a keyword — the reserved-word check, recovery
resync, the diagnostic cards, the parser’s tag(...) calls, and the compiler’s
provenance kind strings — derives from this table or references a kw
constant, so a keyword string is never written twice.
Modules§
- kw
- The CAPS spelling of every keyword — the one place each literal appears.
Structs§
- Card
- The correct-syntax reference for one keyword: its canonical written form (with
<slots>and[optional]parts), a one-line plain meaning, and a real, valid example a model can copy. Mirrorsdocs/SPEC.md, “DSL: keywords”. - Keyword
- One keyword: its spelling, whether it may begin a top-level statement, and its syntax card.
Constants§
- KEYWORDS
- Every keyword, in teaching order. The top-level statements come first (so
filtering
top_levelyields the menu order), thenIMPORT/AS, then the body and modifier words.
Functions§
- card_
for - The syntax card for
keyword, orNoneif it is not a known keyword. - is_
reserved - Whether
wordis a reserved keyword. - is_
top_ level - Whether
wordcan begin a top-level statement (used by recovery resync). - keyword_
in - The first keyword named anywhere in
message(selects its card in a diagnostic). Splits on non-alphabetic characters and returns the first token that is a keyword. - top_
level_ forms - The keywords that may begin a top-level statement, in teaching order — shown as the menu when an error is not tied to one specific keyword.