[antlr-interest] two part operators

J. Stephen Riley Silber jsrs701 at yahoo.com
Mon Jul 13 04:58:32 PDT 2009


I might not be understanding how you want them both to be binary operators.  But what if you have two different tokens for each operator, eg. 'X' and 'X NOT', and treat them as different operators?

--- On Mon, 7/13/09, Jennifer Cooper <jenncooper84 at yahoo.co.uk> wrote:

From: Jennifer Cooper <jenncooper84 at yahoo.co.uk>
Subject: [antlr-interest] two part operators
To: antlr-interest at antlr.org
Date: Monday, July 13, 2009, 2:35 AM

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







      
-----Inline Attachment Follows-----


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090713/47553648/attachment.html 


More information about the antlr-interest mailing list