So I have it working with rewrite rules now:
e : e '.' ID -> ^('.' e ID)
| e '.' 'this' -> ^('.' e 'this')
| '-' e -> ^('-' e)
| e '*' b=e -> ^('*' e $b)
| e (op='+'|op='-') b=e -> ^($op e $b)
| INT -> INT
| ID -> ID
;
But take a look at the multiplication rule: it needs a label on the second e.
plain e is ambiguous. I decided that plain e references the left recursive
version; since it will disappear during the transformation, putting a label on
that one won't work. we have to put a label on the second reference as you see
above. this is not optimal. can anyone think of a better way to differentiate
between the left and right e references in a single alternative? [Note that e
refers to the entire tree created so far.]
Ter
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.