Hi everyone, I'm Marco Mastropaolo, the author of a Lua interpreter and am using ANTLR4.3 for parsing (in C#) - and it's the first time I navigate in this group.
I have a grammar I'm using and an evil script file here:
https://www.dropbox.com/sh/z19czj6nttw1ou8/AABpwaQTY3f7t6RwlgTHchXQa?dl=0If I try to parse that file (which is actually a version reduced to the minimum which presents the problem) it seems stuck forever.
I tried using the Java version and then doing:
grun Lua chunk bugged.lua -trace -diagnostics
and it prints
enter chunk, LT(1)=onInsertItem
enter block, LT(1)=onInsertItem
enter stat, LT(1)=onInsertItem
enter varlist, LT(1)=onInsertItem
enter var, LT(1)=onInsertItem
consume [@0,2:13='onInsertItem',<50>,2:0] rule var
exit var, LT(1)==
exit varlist, LT(1)==
consume [@1,15:15='=',<5>,2:13] rule stat
enter explist, LT(1)=function
enter exp, LT(1)=function
enter anonfunctiondef, LT(1)=function
consume [@2,17:24='function',<17>,2:15] rule anonfunctiondef
enter funcbody, LT(1)=(
consume [@3,25:25='(',<8>,2:23] rule funcbody
enter parlist, LT(1)=self
enter namelist, LT(1)=self
consume [@4,26:29='self',<50>,2:24] rule namelist
consume [@5,30:30=',',<10>,2:28] rule namelist
consume [@6,32:35='item',<50>,2:30] rule namelist
exit namelist, LT(1)=)
exit parlist, LT(1)=)
consume [@7,36:36=')',<45>,2:34] rule funcbody
enter block, LT(1)=return
enter retstat, LT(1)=return
consume [@8,40:45='return',<23>,3:1] rule retstat
enter explist, LT(1)=(
enter exp, LT(1)=(
enter prefixexp, LT(1)=(
enter varOrExp, LT(1)=(
It happens with both C# and Java versions and I tried with 4.2.2, 4.3 and 4.4.
Now I don't know how to go further on my diagnostics - I think it's likely to be a bug in the grammar having some ambiguous declaration causing exponential times.. but I don't really know how to go on.
Any help is really appreciated, thanks!!
-- marco