**Posted By:**
John_Crater

**Posted On:**
Thursday, January 2, 2003 02:59 PM

I have a parser rule that works fine in YACC but results in an "infinite recursion" error in ANTLR. The rule is... scalar_exp: scalar_exp (AS)? NAME | scalar_exp (PLUS | MINUS | MULT | DIVIDE) scalar_exp | constant | variable | LPAREN scalar_exp RPAREN; This is obviously recursive. But, my question is why does ANTLR care since the input will obviously have some termination sequence which avoids true infinite recursion. Also, how to I rework something like this so that ANTLR won't barf on it? Thanks.

More>>
I have a parser rule that works fine in YACC but results in an "infinite recursion" error in ANTLR.

The rule is...

scalar_exp:

scalar_exp (AS)? NAME

| scalar_exp (PLUS | MINUS | MULT | DIVIDE) scalar_exp

| constant

| variable

| LPAREN scalar_exp RPAREN;

This is obviously recursive. But, my question is why does ANTLR care since the input will obviously have some termination sequence which avoids true infinite recursion. Also, how to I rework something like this so that ANTLR won't barf on it?

Thanks.

<<Less