[antlr-interest] NON DETERMINISM PROBLEM

Shalini Sharma shalini.sh at gmail.com
Tue Mar 29 18:42:42 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


On Tue, 29 Mar 2005 09:58:31 -0500, John B. Brodie <jbb at acm.org> wrote:
> Greetings!
> 
> You asked:
> >due to non determism at "number" whatever lookahead i use .
> >non-determinism remains at rule array_index_seq . what should be done
> >for such problem
> >
> >array_index_seq:
> >                       array_index (array_index )*
> >           ;
> >
> >array_index:
> >       LBRAC number RBRAC
> >       ;
> >
> >number:
> >                 NUMBER
> >               | TIC_NUMBER
> >               | NUMBER TIC_NUMBER
> >       ;
> >
> >
> 
> try replacing your number rule with:
> 
> number :
>      NUMBER ( TIC_NUMBER )?
>    | TIC_NUMBER
>    ;
> 
> Hope this helps...
>   -jbb
>


More information about the antlr-interest mailing list