The parser framework

Parsing is done by Parser#parse invokation after parser creation .Before parsing It is possible to setup the parse session using Parser#getParseSession , and then set it.

It is possible at Parser construction to allow missing match manager class.

Before parsing a parser setup can be done using:
Enable the compute syntax node make able to obtains a syntax tree in parsing result. Usualy enable this is done when match manager are not use.
By default parse node are not keep in memory when they are no more needed. Parse node can be keep in memory for debug purpose.
When manage ambiguous grammar make abel to give a number of alternative limit.

The parser data used by parser ( parameter of parser constructor ) is generated using  the parser data generator

lexical analysis included : whitespace management and token are defined in the input grammar parameter of  the parser data generator.

If ambiguity detected and not allowed then a HasAmbiguityParserException is throw, and ambiguous parse(s) node(s) are output in 'runtime/parsetree <[0-9]+> .xml' file(s). The show parse tree tool can be used to visualize for analysis the ambigous parse tree ( screen shot for an ambiguity ).

The parsing result : error, parse node tree, syntax node tree, and data generated by match manager ( getUniqData and getDataByAlternative of IParseNode )

It is the AST of transformed grammar. see parser setting for parse tree kept in memory
It is the AST of original grammar ( with white space added ). see parser setting for syntax node.
It is also possible to get parsing result information from parse session.

Each parse node give the text it match in parsed input: start line/column and end line/column.

Each parse node have a data field computed by match manager, the data field of root resulting parse node can be the reference on parsing result: can be a specific AST.

In case of reduce error ( runtime exception ) the error is memorized and then parsing is resumed whithout invoking match manager. In this case parsing can fall in ambiguity error if ambiguities are managed at semantic level ( in match manager class ).

© 2008-2009, parser4j