[antlr-interest] How to define multi and div?

Scott Stanchfield scott at javadude.com
Sat Dec 10 08:13:17 PST 2005


Because they have the same precedence, they should really be the same rule.
For a really good treatment of expressions (if I do say so myself),
including this exact case , see my ANTLR Tutorial at
 
 http://javadude.com/articles/antlrtut
 
-- Scott


  _____  

From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.
org] On Behalf Of ??
Sent: Saturday, December 10, 2005 10:33 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] How to define multi and div?


I'm studing the expression parsing.
here I define the multi expr and div expr.
 
multiExpr
     :     (parenExpr | divExpr) (MULTI^ parenExpr)+
     ;
divExpr
      :    (parenExpr | multiExpr) (DIV^ parenExpr)+
      ;
 
 
this define raised recurse error. thoe in fact, the left of  multi expr can
be div expr.and each other.
 
can you give me some suggest ?
thanks~

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20051210/ba5d9c5c/attachment.html


More information about the antlr-interest mailing list