[antlr-interest] Perority Enforcing using Antlr Grammar
Muhammad Masoom Alam
doublemalam at yahoo.co.uk
Fri Jun 16 01:06:49 PDT 2006
Hi all,
Precisely the question is that i have some oridnary
boolean expressions. like
BooleanExp: Predicate ((AND|OR) Predicate)*
;
This predicate is any boolean expression as we have in
java or C++, but how to mark the perority here. i mean
i can have a predicate expression of the form:
(a=2) and (c<3 or d>4)
How to make these preferecnes implementable i.e. if
there is a start paranthesis, there should be an end
parantheisis and there can be more paranthesis within
predicates. If i make the grammar of the form:
BooleanExp: (LPAREN|Empty) Predicate (RPAREN|Empty)
((AND|OR) Predicate)*
;
This is logically not correct, since start can be
empty and end can be a paranthesis, which is really
not the required result!
Thanks
MA
--- Muhammad Masoom Alam <doublemalam at yahoo.co.uk>
wrote:
> Hi all,
>
> sorry if my question is a stupid one, as i am a new
> bie. How to enforce perority rules using Antlr.
>
> e.g. I have the following conditions
>
> (Predicate1 And (Predicate2 Or Predicate3))
>
> In the above, Grammar, paranthesis are used to group
> and enforce perority, but how this will be done
> using
> the Antlr Grammar.
>
> Thanks in Advance.
> MA
>
>
>
>
>
___________________________________________________________
>
> Copy addresses and emails from any email account to
> Yahoo! Mail - quick, easy and free.
> http://uk.docs.yahoo.com/trueswitch2.html
>
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html
More information about the antlr-interest
mailing list