[antlr-interest] Rewrite rule

Terence Parr parrt at cs.usfca.edu
Sat Mar 17 15:52:04 PDT 2007


On Mar 16, 2007, at 7:10 PM, Dennis Katumalla wrote:

> What should my rewrite rule look like if I wanted ^(MULTIPLY factor  
> factor) or ^(DIVIDE factor factor)
>
> term : factor ((MULTIPLY | DIVIDE) factor)*
>         ;

I'd do an operator:

term : factor ((MULTIPLY^ | DIVIDE^) factor)* ;

Ter





More information about the antlr-interest mailing list