Hey all, I'm fairly new to ANTLR and grammars/parsing in general so apologies if this question doesn't make a whole lot of sense. I'll try to explain what I'm trying to achieve as best I can.
I'm trying to make a rule that will rewrite into a nested tree (similar to a binary tree). For example: a + b + c + d; Would parse to a tree like: a + b + c + d Or typed another way: ( ( (a + b) + c) + d). Basically each root node would have three children (LHS '+' RHS) where LHS could be more nested nodes. My first attempt was something like: rule: lhs '+' ID; lhs: ID | rule; (with some tree rewrites) which gives me an error about it being left-recursive. I'm not sure how to solve this without some type of recursion. How can I achieve this? Any input is appreciated. Thanks, Nic
_______________________________________________ antlr-dev mailing list antlr-dev@antlr.org http://www.antlr.org/mailman/listinfo/antlr-dev