[antlr-interest] two part operators

Jennifer Cooper jenncooper84 at yahoo.co.uk
Mon Jul 13 02:35:00 PDT 2009


Hi everyone!
I've just started using antlr and come upon a problem. T try to make lexer recognize two different operators: OP and OP NOT. I want to treat both of them as binary operators and not to treat NOT as unary operator.  My current solution is:

op_expr 
    :    expr (OP^ not_expr)* 
    ; 
not_expr 
    :    expr 
    |       NOT^ expr  
    ;

but this one obviously doesn't treat NOT as part of the binary OP NOT operator.

Any clues?

Cheers,
Jennifer


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090713/8fb0f2ae/attachment.html 


More information about the antlr-interest mailing list