[antlr-interest] Pruning the Parse Tree

Aaron Armstrong ae.armstrong at gmail.com
Thu Mar 6 20:59:41 PST 2008


Using the Java grammar, I turned off memoization and was able to get a parse
tree.

However, given this grammar:

memberDecl
 : genericMethodOrConstructorDecl
 | methodDeclaration
 | fieldDeclaration
 | ...;

portions of code with a field declaration yield both a method declaration
and a field declaration,
as the parser tries to parse out a methodDeclaration for the input before it
decides that it is
a fieldDeclaration.  Both are found in the final parse tree, and I need to
get rid of the
superfluous nodes.  I don't know if this is default antlr behavior or if
this is a bug.

Anyway, if anybody has had problems with this and there is a solution, let
me know.

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080306/71a77b9c/attachment.html 


More information about the antlr-interest mailing list