A Parser object is a recursive descent parser, with backtracking, that works with a grammar and a lexicon to provide lexical, syntactic, and semantic analysis of input. It handles ambiguously defined tokens and grammars and may potentially generate multiple interpretations from the same text.
Recursive decent parsers are susceptible to exponential run times. Writing the grammar in such a way as to reduce backtracking can improve run times.
ishml.Parser({lexicon:lexicon, grammar:rule})Returns an instance of the Parser object. Use of new operator is optional.
The lexicon argument is an instance of the ishml.Lexicon object that should be used tokenizing input.
The rule argument is an instance of the ishml.Rule object that should be used for syntactic parsing and semantic analysis.
.lexiconThe ishml.Lexicon object that was specified in the constructor.
.grammarThe ishml.Rule object that was specified in the constructor.
.analyze(text)Parses the text argument and return an array of ishml.Interpretation.
The text argument is a string of characters to be analyzed.
See also parsing tutorial.