[antlr-interest] infinite loop in ASTFactory
Micheal J
open.zone at virgin.net
Thu Apr 21 20:22:36 PDT 2005
> Hi!
>
> I noticed a strange behaviour here.. perhaps i'm doing
> something wrong,
> but..
>
> I have a rule like:
>
> main: e:rule1 a:rule2;
>
> .. and it works, but if i add some AST construction code:
>
> main: e:rule1 a:rule2
> {
> #main = #([MAIN,"main"], e, a);
> }
> ;
>
> .. then it hangs in infinite loop somewhere in ASTFactory
You should turn off automatic tree construction if you're using building
manually.
Try the following:
1. Auto off (note the "!" after main)
main!: e:rule1 a:rule2
{
#main = #([MAIN,"main"], e, a);
}
;
2. Using #main
main: e:rule1 a:rule2
{
#main = #([MAIN,"main"], #main);
}
;
Cheers,
Micheal
More information about the antlr-interest
mailing list