|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--net.percederberg.grammatica.parser.Parser
|
+--net.percederberg.grammatica.parser.RecursiveDescentParser
A recursive descent parser. This parser handles LL(n) grammars, selecting the appropriate pattern to parse based on the next few tokens. The parser is more efficient the fewer look-ahead tokens that is has to consider.
| Constructor Summary | |
RecursiveDescentParser(Tokenizer tokenizer)
Creates a new parser. |
|
RecursiveDescentParser(Tokenizer tokenizer,
Analyzer analyzer)
Creates a new parser. |
|
| Method Summary | |
void |
addPattern(ProductionPattern pattern)
Adds a new production pattern to the parser. |
Node |
parse()
Parses the input stream and creates a parse tree. |
void |
prepare()
Initializes the parser. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public RecursiveDescentParser(Tokenizer tokenizer)
tokenizer - the tokenizer to use
public RecursiveDescentParser(Tokenizer tokenizer,
Analyzer analyzer)
tokenizer - the tokenizer to useanalyzer - the analyzer callback to use| Method Detail |
public void addPattern(ProductionPattern pattern)
throws ParserCreationException
addPattern in class Parserpattern - the pattern to add
ParserCreationException - if the pattern couldn't be
added correctly to the parser
public void prepare()
throws ParserCreationException
prepare in class ParserParserCreationException - if the parser couldn't be
initialized correctly
public Node parse()
throws ParserCreationException,
ParseException
parse in class ParserParserCreationException - if the parser couldn't be
initialized correctly
ParseException - if the input couldn't be parsed
correctlyprepare()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||