=?gb2312?q?=BB=D8=B8=B4=A3=BA=20Re:=20[antlr-interest]=20a=20left=20recur?=
=?gb2312?q?sive=20walker=20rule?=
=?gb2312?q?=CB=EF=BC=CD=B8=D5=20Jigang=20(Robert)=20Sun?=
sunjigang1965 at yahoo.com.cn
Tue Jul 18 11:04:12 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����ï¿ï¿½ï¿½ï¿½ï¿½
> http://cn.mail.yahoo.com/
>
>
>
> ---------------------------------
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1/min.
___________________________________________________________
Mp3·è¿ñËÑ-иèÈȸè¸ßËÙÏÂ
http://music.yahoo.com.cn/?source=mail_mailbox_footer
More information about the antlr-interest
mailing list