[antlr-interest] Simple expression grammar
Maciej Bakalarz
shipmen at gmail.com
Thu May 15 11:07:37 PDT 2008
>> OK I have written my grammar for boolean expressions mentioned earlier
>> (like ( (a>=3 || b<=5)&& c>=4 ) ).
>>
>> But my grammar accept also expressions like "abc def ght" and many other
>> strange constructions
>
> I think it is only accepting that because you have used:
>
> logical_or_expression+
>
> Remove the + and it will only accept a single logical expression. this
> code accepts abc def ght as 3 separate logical_or_expressions.
I have tried it but ... when I remove '+' it will not parse correctly
expression like "x>=4 || b<=5 && d<=5" . It will parse only 'x'
Thanks
Maciek Bakalarz
More information about the antlr-interest
mailing list