[antlr-interest] AST for repeated occurrences of binary operators

David-Sarah Hopwood david-sarah at jacaranda.org
Tue Nov 24 16:22:29 PST 2009


Caetano Sauer wrote:
>> On Nov 24, 2009 9:38 PM, "David-Sarah Hopwood" <david-sarah at jacaranda.org>
>> wrote:
>>  expr : andExpr (^OR andExpr)*;
>
> I am not sure if that's equivalent. In the a OR b OR c case, it would
> generate the tree (OR a (OR b (OR c))).

Actually it would produce (OR a (OR b c)).

> What I want is (OR a b c).

I think that will be produced by:

  orExpr : andExpr (^OR andExpr (OR! andExpr)*)?;

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 292 bytes
Desc: OpenPGP digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20091125/19857032/attachment.bin 


More information about the antlr-interest mailing list