The SLR(1) action/goto table shape itself, plus the two lookups every
LR-family engine needs at match time -- interpreted (Grammar.LR,
Grammar.GLR.Runtime) or compiled (generated Grammar.Native.LR/
.GLR code) alike.
Building a table from a grammar (Grammar.LRTable.Builder.build/1,
which needs Desugar/Sets/Automaton) is a dev-time-only concern
that stays in ichor proper -- this module holds only what a
generated parser (or the interpreted engines) still calls once a
table already exists.
Summary
Functions
The current lookahead terminal name at pos in stream, or
end_symbol once input is exhausted -- shared by every LR-family
engine (Grammar.LR, Grammar.GLR.Runtime, and generated
Grammar.Native.LR/.GLR code alike), interpreted or compiled.
The shared "no action applies here" parse error, naming the offending token (or end of input).
Types
@type action() :: {:shift, state_id()} | {:reduce, production_id :: non_neg_integer()} | :accept
@type state_id() :: non_neg_integer()
@type t() :: %Grammar.LRTable{ action: %{required(state_id()) => %{required(atom()) => [action()]}}, end_symbol: atom(), goto: %{required(state_id()) => %{required(atom()) => state_id()}}, productions: %{required(non_neg_integer()) => Grammar.LRTable.Production.t()}, root: atom(), start_state: state_id(), start_symbol: atom() }
Functions
@spec current_terminal(tuple(), non_neg_integer(), atom()) :: atom()
The current lookahead terminal name at pos in stream, or
end_symbol once input is exhausted -- shared by every LR-family
engine (Grammar.LR, Grammar.GLR.Runtime, and generated
Grammar.Native.LR/.GLR code alike), interpreted or compiled.
@spec unexpected_error(tuple(), non_neg_integer()) :: Ichor.Error.t()
The shared "no action applies here" parse error, naming the offending token (or end of input).