[antlr-interest] Re: NON DETERMINISM PROBLEM
John B. Brodie
jbb at acm.org
Tue Mar 29 19:17:17 PST 2005
>this is not getting solved as recursion exists in
>array_index_seq:
> array_index (array_index )*
> ;
>
>this would exist everywhere where there is non-determinism in subrule
No.
You are correct that if a rule were non-deterministic, all of it uses would be
problematic.
But we have fixed the non-determinism in the `number` rule, so there now is no
(or rather now should be no) problem with the `array_index_seq` rule.
I think something else is non-deterministic in the bigger grammar that you
tried to simplify for display in this example.
Does your installed antlr.Tool report any non-determinism with this grammar?
/* --- cut here --- cut here --- begin test.g --- cut here --- cut here*/
class testParser extends Parser;
array_index_seq :
array_index ( array_index )*
;
array_index :
LBRAC number RBRAC
;
number :
NUMBER ( TIC_NUMBER )?
| TIC_NUMBER
;
class testLexer extends Lexer;
NUMBER : 'n';
TIC_NUMBER : 't';
LBRAC : '(';
RBRAC : ')';
/* --- cut here --- cut here --- end test.g --- cut here --- cut here*/
mine does not.
I believe that something else is causing your non-determinism problem.
Please post more.
-jbb
More information about the antlr-interest
mailing list