Info.Lr1SourceLR(1) state information. LR(1) states extend LR(0) cores with lookahead information, determining when reductions should be performed.
all g is the set of all LR(1) states in grammar g
accepting g is the set of LR(1) accepting states in grammar g. These states are reached after fully recognizing an entrypoint.
wait g is the set of "wait" states in grammar g. A wait state is an LR(1) state where the parser must look at more input before deciding how to proceed. Wait states include initial states and targets of shift transitions, excluding accepting states.
to_lr0 g s returns the LR(0) "core" state corresponding to LR(1) state s. Multiple LR(1) states may share the same LR(0) core but differ in lookaheads.
incoming g s returns the symbol that labels the transition into state s. Returns None for initial states. For non-initial states, returns Some sym where sym is the symbol that was parsed to reach this state.
items g s returns the set of LR(0) items in the kernel of state s, i.e., the items before closure is applied.
val is_entrypoint :
'g grammar ->
'g n Fix.Indexing.index ->
'g production Fix.Indexing.index optionis_entrypoint g s returns Some prod if s is an entrypoint state, where prod is the pseudo (start) production. Returns None otherwise.
entrypoints g is the set of LR(1) states that correspond to grammar entrypoints
Hash table mapping entrypoint names to their corresponding LR(1) states
Debug printing functions. Formats are not stable across versions.
Converts an LR(1) state to a debug string
Converts a list of LR(1) states to a debug string
Converts a set of LR(1) states to a debug string
Converts the incoming symbol of a state to a debug string
shift_on g s is the set of terminals that state s can shift on, i.e., terminals for which there is a shift transition from s.
reduce_on g s is the set of terminals that trigger a reduction in state s, i.e., lookahead terminals for which a reduce action is taken.
reject g s is the set of terminals that cause a syntax error in state s, i.e., terminals for which there is no shift, reduce, or default action.
val predecessors :
'g grammar ->
'g n Fix.Indexing.index ->
'g n Utils.Misc.indexset Utils.Misc.lazy_streampredecessors g s is the lazy stream of LR(1) states that have a transition going to state s. Lazy evaluation avoids materializing all predecessors upfront.
val intersect :
'g grammar ->
'g n Utils.Misc.indexset ->
'g n Utils.Misc.indexset ->
'g n Utils.Misc.indexsetWrapper around IndexSet.inter speeding-up intersection with all
val default_reduction :
'g grammar ->
'g n Fix.Indexing.index ->
'g production Fix.Indexing.index optiondefault_reduction g s returns the default reduction for state s, if any. Some states have a single applicable reduction that can be taken without checking the lookahead terminal.