[antlr-interest] Limits of tree generation (C++)

marcschellens m_schellens at hotmail.com
Tue Oct 7 01:16:06 PDT 2003


I have:

comp_assign_expr!
    : #(a1:PLUS_EQ l1:expr r1:expr) 
        { #comp_assign_expr=#([ASSIGN,":="],([PLUS,"+"],l1,r1),l1);} 
    ; 

and get for example (for l1 = VAR, r1 = 1):

Tree parser output:
<:=
  <+ VAR 1 >VAR 1
>

But I think it should be:

Tree parser output:
<:=
  <+ VAR 1 >VAR // no 1
>

The problem is obviously, that I use one ASTNode (l1) twice in the
output tree.
Using ANTLR 2.7.2, how can I archieve what I want?
thanks,
marc



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list