[antlr-interest] error messages + treeParser with OR'ed root

Bryan Ewbank ewbank at gmail.com
Fri Mar 18 10:34:26 PST 2005


I've also had some limited success with using predicates to fake it out:
    (PLUS|MINUS|STAR|DIV) => #( op:. lType = expr rType = expr)
       {
            // op will be one of the four
       }

On Fri, 18 Mar 2005 09:24:34 -0500, Monty Zukowski
<monty at codetransform.com> wrote:
> > Second problem has to do with an root in walker that is OR'ed.
> > #( (PLUS|MINUS|STAR|DIV) lType = expr rType = expr)
> > gives an error of unexpected token '('.
> >
> > Any idea how I can fix this?
> 
> Currently ANTLR cannot have OR'd roots.  You'll have to do something like
> 
> #(PLUS expr expr)
> | #(MINUS expr expr)


More information about the antlr-interest mailing list