Skip to content

Symbols โ€‹

Simple explanation โ€‹

Every distinct thing in a grammar โ€” a keyword, an identifier, an expression โ€” gets a numeric id called a symbol. Symbols say whether a node is named (structural) or anonymous (punctuation), visible, or an extra like whitespace.

Technical explanation โ€‹

language/symbols.zig defines SymbolInfo { id, name, kind, metadata } with kinds terminal, non_terminal, external, and end. Metadata flags: visible (appears in trees), named (structural vs punctuation), supertype (abstract grouping symbol), extra (skipped/attached outside the grammar proper). core/symbol.zig provides the shared Symbol / SymbolId vocabulary (0 = end). The Language helpers (symbolName, symbolIsNamed, symbolForName, โ€ฆ) are what nodes and queries use to resolve ids to names.

Released under the MIT License.