[antlr-interest] forcing parenthesis (no precedence)

Gavin Lambert antlr at mirality.co.nz
Thu Jul 16 04:48:27 PDT 2009


At 18:57 16/07/2009, hakan eryargi wrote:
 >thank you but i can't get it. simply making AND's and OR's have
 >same precedence doesnt force user to use parenthesizes.
 >expression is simply evaluated from left to right ?

Just parse it as normal, but put some code into the tree parser to 
detect cases you want to consider invalid and raise an error.

 From the sounds of it, it should be easy to detect; eg. if you're 
on an OR root and either the left or right expression is an AND 
root, then it's invalid.



More information about the antlr-interest mailing list