IncrementalEngine.INSPECTIONThis signature describes the inspection API that is made available to the user when --inspection is used.
include SYMBOLSThe type 'a terminal represents a terminal symbol. Its parameter 'a represents the type of the semantic values associated with this symbol. The concrete definitions of this type is generated.
The type 'a nonterminal represents a nonterminal symbol. Its parameter 'a represents the type of the semantic values associated with this symbol. The concrete definitions of this type is generated.
The type 'a symbol represents a terminal or nonterminal symbol. It is the disjoint union of the types 'a terminal and 'a nonterminal.
The type 'a lr1state is meant to be the same as in INCREMENTAL_ENGINE.
The type production is meant to be the same as in INCREMENTAL_ENGINE. It represents a production of the grammar. A production can be examined via the functions lhs and rhs below.
type item = production * intAn 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_nonterminals : _ nonterminal -> _ nonterminal -> intval compare_productions : production -> production -> intincoming_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.
items 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 : production -> xsymbollhs prod is the left-hand side of the production prod. This is always a non-terminal symbol.
val rhs : production -> 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 : _ 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 : _ nonterminal -> _ 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.
xfirst 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.
The type env is meant to be the same as in INCREMENTAL_ENGINE.
feed 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.