[antlr-interest] rule rewrite

Fırat KÜÇÜK firatkucuk at gmail.com
Mon Apr 2 02:35:27 PDT 2007


wonderful :)
thanks a lot.

2007/4/2, David Holroyd <dave at badgers-in-foil.co.uk>:
>
> On Mon, Apr 02, 2007 at 11:15:09AM +0300, F?rat K???K wrote:
> > this is simple sample inline calculator grammar:
> >
> > start : operation ((PLUS^ | MINUS^) operation)* ;
> > operation : NUMBER ((ASTERISK^ | SLASH^) NUMBER)* ;
> >
> > but i need:
> >
> > start : operation ((ADDITION^ | SUBTRACTION^) operation)*;
> >
> > how can i rewrite this rules without changing rule.
>
> Do you mean like this,
>
>   start : operation (additionOperator^ operation)* ;
>   additionOperator : PLUS -> ADDITION | MINUS -> SUBTRACTION ;
>
> (untested)
>
>
> --
> http://david.holroyd.me.uk/
>



-- 
Öğr. Gör. Fırat KÜÇÜK
ADAMYO Distance Learning
SAKARYA University / TURKEY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070402/64d4c0eb/attachment-0001.html 


More information about the antlr-interest mailing list