=?gb2312?q?=20=BB=D8=B8=B4=A3=BA=20Re:=20[antlr-interest]=20a=20left=20re?= =?gb2312?q?cursive=20walker=20rule?=

=?gb2312?q?=CB=EF=BC=CD=B8=D5=20Jigang=20(Robert)=20Sun?= sunjigang1965 at yahoo.com.cn
Tue Jul 18 16:54:18 PDT 2006


Sorry I had a few days off.

The corresponding parser rule is A : ("("A")" |B)+ C, I turned off "(" and ")", thus caused the>
problem in tree walker.
 
 Jigang
 
> --- Loring Craymer <lgcraymer at yahoo.com>дµÀ:
> 
> > This looks very weird--you have no termination condition for the recursion.  Normally,
> recursive
> > rules have termination conditions and the recursion-to-iteration conversion is relatively
> > straightforward.  I cannot easily imaging how you got to this form.  What did the annotated
> > parser rule look like that got you here?
> > 
> > --Loring
> > 
> > "��͸￁ Jigang (Robert) Sun" <sunjigang1965 at yahoo.com.cn> wrote: Hi,
> > I have a rule in tree walker, which is left recursive:  A : (A|B)+ C ,
> > 
> > so I am trying to eliminate it 
> > 
> > A : (A|B)+ C
> > => A : ( A(A|B)* | B(A|B)*) C
> > => A : A(A|B)* C | B(A|B)* C
> > => A : B(A|B)* C  ((A|B)* C)*
> > => A : B ( (A|B)* C )+
> > => A : B ( ( B((A|B)* C)+ |B )* C )+ //replace A with " B ( (A|B)* C )+ "
> > => A : B( ( B [((A|B)* C)+ | ]* C)+ // need to replace A with " B ( (A|B)* C )+ " again
> > => A : ... //then again and again forever, never ends
> > 
> > Any better solution?
> > 
> > Thanks
> > 
> > Jigang
> > 



		
___________________________________________________________ 
ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ 
http://cn.mail.yahoo.com/


More information about the antlr-interest mailing list