**Posted By:**
sun_set

**Posted On:**
Thursday, January 31, 2002 07:25 PM

I have a subset of rules that I have to convert to ANTLR compatible format: expression : expression '+' term | expression '-' term | term; term : term '*' factor | factor; factor : VAR | INT | '(' expression ')'; I tried to fix the infinite recursion errors by changing to: expression : ( term | term ('+' term)+ | term ('-' term)+ ); term :( factor | factor ('*' factor)+ ); factor : ( VAR | constant | '(' expression ')' ); now I got these errors warning: nondeterminism upon k==1:VAR,INT,LPAREN between alts 1 and 2 of block warning: nondeterminism upon k==1

More>>
I have a subset of rules that I have to convert to ANTLR compatible format:

expression : expression '+' term | expression '-' term | term;

term : term '*' factor | factor;

factor : VAR | INT | '(' expression ')';

I tried to fix the infinite recursion errors by changing to:

expression : ( term | term ('+' term)+ | term ('-' term)+ );

term :( factor | factor ('*' factor)+ );

factor : ( VAR | constant | '(' expression ')' );

now I got these errors

warning: nondeterminism upon

k==1:VAR,INT,LPAREN

between alts 1 and 2 of block

warning: nondeterminism upon

k==1:VAR,INT,LPAREN

between alts 1 and 3 of block

warning: nondeterminism upon

k==1:VAR,INT,LPAREN

between alts 2 and 3 of block

warning: nondeterminism upon

k==1:VAR,INT,LPAREN

between alts 1 and 2 of block

warning: nondeterminism upon

k==1:"call","while","if","assign"

between alts 1 and 2 of block

Please help. Thanks!

<<Less