InspectionTableInterpreter.MakeThis functor is invoked inside the generated parser, in --table mode. It constructs the inspection API on top of the inspection tables described in InspectionTableFormat.
module TT : TableFormat.TABLESmodule IT : InspectionTableFormat.TABLES with type 'a lr1state = intmodule ET :
EngineTypes.TABLE
with type terminal = int
and type nonterminal = int
and type semantic_value = Obj.tmodule E : sig ... endinclude IncrementalEngine.SYMBOLS
with type 'a terminal := 'a IT.terminal
with type 'a nonterminal := 'a IT.nonterminalThe type 'a symbol represents a terminal or nonterminal symbol. It is the disjoint union of the types 'a terminal and 'a nonterminal.
An LR(0) item is a pair of a production prod and a valid index i into this production. That is, if the length of rhs prod is n, then i is comprised between 0 and n, inclusive.
The following are total ordering functions.
val compare_terminals : _ IT.terminal -> _ IT.terminal -> intval compare_nonterminals : _ IT.nonterminal -> _ IT.nonterminal -> intval incoming_symbol : 'a IT.lr1state -> 'a symbolincoming_symbol s is the incoming symbol of the state s, that is, the symbol that the parser must recognize before (has recognized when) it enters the state s. This function gives access to the semantic value v stored in a stack element Element (s, v, _, _). Indeed, by case analysis on the symbol incoming_symbol s, one discovers the type 'a of the value v.
val items : _ IT.lr1state -> item listitems s is the set of the LR(0) items in the LR(0) core of the LR(1) state s. This set is not epsilon-closed. This set is presented as a list, in an arbitrary order.
val lhs : int -> xsymbollhs prod is the left-hand side of the production prod. This is always a non-terminal symbol.
val rhs : int -> xsymbol listrhs prod is the right-hand side of the production prod. This is a (possibly empty) sequence of (terminal or nonterminal) symbols.
val nullable : _ IT.nonterminal -> boolnullable nt tells whether the non-terminal symbol nt is nullable. That is, it is true if and only if this symbol produces the empty word epsilon.
val first : _ IT.nonterminal -> _ IT.terminal -> boolfirst nt t tells whether the FIRST set of the nonterminal symbol nt contains the terminal symbol t. That is, it is true if and only if nt produces a word that begins with t.
val xfirst : xsymbol -> _ IT.terminal -> boolxfirst is analogous to first, but expects a first argument of type xsymbol instead of _ terminal.
val foreach_terminal : (xsymbol -> 'a -> 'a) -> 'a -> 'aforeach_terminal enumerates the terminal symbols, including error.
val foreach_terminal_but_error : (xsymbol -> 'a -> 'a) -> 'a -> 'aforeach_terminal_but_error enumerates the terminal symbols, excluding error.
val feed :
'a symbol ->
IncrementalEngine.position ->
'a ->
IncrementalEngine.position ->
'b E.env ->
'b E.envfeed symbol startp semv endp env causes the parser to consume the (terminal or nonterminal) symbol symbol, accompanied with the semantic value semv and with the start and end positions startp and endp. Thus, the automaton makes a transition, and reaches a new state. The stack grows by one cell. This operation is permitted only if the current state (as determined by env) has an outgoing transition labeled with symbol. Otherwise, Invalid_argument _ is raised.