Skip to content

Language Tables โ€‹

Simple explanation โ€‹

Parse tables pre-answer every "what now?" decision so parsing is fast: for each grammar state and next token, the table says shift, reduce, or accept.

Technical explanation โ€‹

language/tables.zig holds ParseTable { states, start_state, end_symbol, error_symbol }. Each ParseState carries actions (terminal โ†’ Action) and gotos (non-terminal โ†’ state). A ReduceRule names the parent symbol, child count, production id (for fields/aliases), and dynamic precedence. The bundled grammar's tables are a hand-verified SLR(1) construction for the expression grammar โ€” states 0โ€“17 covering programs, expressions, terms, factors, and parenthesization.

Released under the MIT License.