[antlr-interest] Binary Expression Problem!
sohail at taggedtype.net
Tue Jun 20 00:39:51 PDT 2006
EqualityExp: RelationalExp ((Not_Equal|Equal) RelationalExp)+
I forget if antlr supports + though, i usually only use ? * :)
On Tue, 2006-06-20 at 07:23 +0100, Muhammad Masoom Alam wrote:
> Hi All,
> The Grammar below is structured in a way that it
> should observes the perority of relational operators.
> But in this Grammar one problem persists i.e. a Binary
> Expression should be comprised of two operands where
> as from the Grammar it is obvivous that it may come up
> with a single operand too. Could any body help me in
> this regard to overcome the single operand issue
> without loosing the operator's perority.
> e.g. the Grammar permits: "Hello" where as the
> required expression is "Hello" = "Hello" without
> loosing the operator's perority.
> BinaryExp: EqualityExp;
> EqualityExp: RelationalExp ((Not_Equal|Equal)
> RelationalExp: additiveExp ((GT|GTE|LT|LTE)
> additiveExp: MultipicativeExp
> MultipicativeExp: SimpleExp ((MUL|DIV|MOD)
> SimpleExp: STRING|CONSTANTVALUE;
> All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
More information about the antlr-interest