[antlr-interest] ANTLR

Bryan Ewbank ewbank at gmail.com
Tue Apr 4 03:51:44 PDT 2006


There is not enough information in this yacc production; please look
in the file and see if there are any precedence entries towards that
top.  They will start with one of
   %left
   %right
   %nonassoc
and they define the order of evaluation and precedence of the various operators.

On 4/4/06, Yassin.Chkouri at imag.fr <Yassin.Chkouri at imag.fr> wrote:
> How i can to write in antlr this expression recursive writes in Yacc :
>
> c_expr : primary
>         | c_constval
>         | c_expr PLUS c_expr
>         | c_expr MINUS c_expr
> ;

Assuming PLUS and MINUS evalute left to right, the ANTLR to recognize it is:
c_expr : atom ( ( PLUS | MINUS ) atom )* ;
atom:      c_constval | primary ;


More information about the antlr-interest mailing list