[antlr-interest] tree construction, associative operators, NullPointerException
Gavin Lambert
antlr at mirality.co.nz
Thu Aug 7 14:25:05 PDT 2008
At 01:39 8/08/2008, Johan Grande wrote:
>The solution I use until now (non binary trees) is not at all
>satisfying, because not only I would have binary trees, but my
>"solution" doesn't work for rules with more than one operator,
for
>example :
>,----
>| equalityExpression
>| : instanceOfExpression ( ('==' | '!=')
instanceOfExpression
>)*
>| ;
>`----
If you change that to use ('==' | '!=')^ (note the extra caret)
then the operator will become the root node -- this will also
automatically produce a left-associative binary tree.
More information about the antlr-interest
mailing list