Module Info.NonterminalSource

include INDEXED with type 'g n = 'g nonterminal
Sourcetype 'g n = 'g nonterminal
Sourceval cardinal : 'g grammar -> 'g n Fix.Indexing.cardinal
Sourceval of_int : 'g grammar -> int -> 'g n Fix.Indexing.index
Sourceval to_string : 'g grammar -> 'g n Fix.Indexing.index -> string

Converts a nonterminal index to its name string

all g is the set of all non-terminals in grammar g

Sourceval kind : 'g grammar -> 'g n Fix.Indexing.index -> [ `REGULAR | `START ]

Returns `REGULAR for ordinary non-terminals and `START for entrypoint (start) non-terminals

Sourceval semantic_value : 'g grammar -> 'g n Fix.Indexing.index -> string option

semantic_value nt is Some typ if nonterminal nt has a semantic value of type typ, or None for unparameterized non-terminals.

Sourceval nullable : 'g grammar -> 'g n Fix.Indexing.index -> bool

nullable nt is true if nonterminal nt can derive the empty string

first nt is the set of terminals that can begin a string derived from nonterminal nt

Sourceval find : 'g grammar -> ?approx:int -> string -> ('g n Fix.Indexing.index, [ `Mangled of 'g n Fix.Indexing.index | `Dym of (int * string * 'g n Fix.Indexing.index) list ]) Stdlib.result

Finds a nonterminal by name. Checks both regular and mangled names. Returns disambiguation suggestions when the name is not found and approx > 0.