[antlr-interest] tree grammar clarification
jimi at temporal-wave.com
Fri Jun 29 19:59:14 PDT 2007
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Bernardo Elayda
> I'm having a problem converting a grammar to a tree grammar.
> The grammar rule I need to translate is:
> nonzeros : MYNZTN+ -> ^(MYNONZEROS MNZTN)+
Your rewrite produces:
^(MYNONZEROS MYNZTN) ^(MYNONZEROS MYNZTN) ^(MYNONZEROS MYNZTN) ...
Which I think you are aware of. So, I think that if you use:
rulea: nonzeros+ ;
nonzeros : ^(MYNONZEROS MNZTN) ;
I think you will be good to go.
More information about the antlr-interest