[antlr-interest] Re: Heterogeneous AST - simple calculator parser

koud0002 robertkoudelka at power-solutions.com.au
Thu Feb 7 19:47:47 PST 2002


Thanks for your reply.

The AST is now constructed correctly.
However, I am now getting "unexpected end of subtree" 
NoViableAltException from the treewalker.
The treewalker still does not recognize UNARY_MINUS.

I would still like to use the custom AST. 
What am I doing wrong? Thanks

Robert

--- In antlr-interest at y..., Sinan <sinan.karasu at b...> wrote:
> koud0002 wrote:
> > 
> [...]
> > 
> > simpleExpression
> >   : MINUS t:term!
> 
> change to
> 
> 	:m:MINUS^  term      {#m.setType(UNARY_MINUS);}
> 
> you don't need all that UnaryMinusNode stuff. The rest is done in 
the
> treewalker
> 
>  #(UNARY_MINUS expression ....
> 
> same for UNARY_PLUS...
> 
> Sinan


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list