[antlr-interest] error in antlrv3.g? missing suffixes in tree

Jens Boeykens jens.boeykens at gmail.com
Wed Jul 2 01:17:34 PDT 2008


Hi,

I'm on a project where I need to parse grammars. Therefor I use
*antlrv3.g *which
can be fount here:
http://www.antlr.org/grammar/ANTLR/

The problem is this:
consider the example

*grammar T;

a : p+;

*If I parse this grammar I get the following tree:

*(grammar T (RULE a (BLOCK (ALT (BLOCK (ALT p EOA) EOB) EOA) EOB) EOR))

*As you can see there is no '+' in the tree. I need the '+' so I can
regenerate the original grammar.
When using parentheses it works:

*grammar T;

a : (p)+;

(grammar T (RULE a (BLOCK (ALT (+ (BLOCK (ALT p EOA) EOB)) EOA) EOB) EOR))

*Now the '+' has been added to the tree.

My question is: what is to be changed in antlrv3.g so that it also works
with the parentheses?

Thanx!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080702/829a7cc1/attachment.html 


More information about the antlr-interest mailing list