recursion in grammar?

Peri peri12345 at poczta.onet.pl
Sat Dec 27 14:09:21 CET 2003


I'm trying to create Python parser/interpreter using ANTLR. 
Reading grammar from language refference I found:
or_expr::= xor_expr | or_expr "|" xor_expr

For me it looks like infinite recursion. And so it says ANTLR. Maybe I
don't understand EBNF notation. For me it should look like this.
or_expr::= xor_expr | xor_expr "|" xor_expr

and in ANTLR grammar file like this:

or_expr: xor_expr { "\|" xor_expr }, or rather
or_expr: xor_expr ( "\|" xor_expr )*

Do I think good?
ANyone heard of Python grammar for ANTLR?




More information about the Python-list mailing list