Module Info.TransitionSource

goto g is the cardinality of the set of goto transitions in grammar g

any g is the cardinality of the set of all transitions (goto + shift) in grammar g

shift g is the cardinality of the set of shift transitions in grammar g

Inject a goto transition index into the combined transition index space

Inject a shift transition index into the combined transition index space

Project a transition index into either a goto or shift transition index

find_goto s nt finds the goto transition from state s labelled by nonterminal nt. Raises Invalid_argument if no such transition exists.

find_goto_target s nt returns the target state of the goto transition from s labelled by nt. Raises Invalid_argument if no such transition exists.

source tr returns the source (origin) state of transition tr

target tr returns the target (destination) state of transition tr

symbol tr returns the grammar symbol that labels transition tr

goto_symbol tr returns the nonterminal that labels goto transition tr

shift_symbol tr returns the terminal that labels shift transition tr

successors g s returns the set of outgoing transitions from state s

predecessors g s returns the set of incoming transitions to state s

accepting g is the set of accepting transitions in grammar g. These are goto transitions from an initial state to an accepting state, recognizing completion of a grammar entrypoint.

Sourceval to_string : 'g grammar -> 'g transition Fix.Indexing.index -> string

Converts a transition to a debug string of the form "source -> target"

find g src tgt finds the transition from src to tgt, if one exists. Returns None if there is no direct transition between the two states.