On 6/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
"Garrett Rooney" <[EMAIL PROTECTED]> wrote:
> I've been using lemon as the parser generator for ETL
> (http://etl.i-want-a-pony.com/) an open source C based template
> language, and we've been running into some problems with recent
> versions. The first problem is in revision 1.17 of lempar.c. You
> removed an if( yymajor==0 ) return; from Parse, which appears to be
> necessary for the final Parse(pParser, 0, sToken) line in the lemon
> examples (from http://www.hwaci.com/sw/lemon/lemon.html), which we've
> been following in ETL. Putting that line back keeps things from
> segfaulting. If it's more correct to not have that final Parse call I
> can simply remove it, but for now I've been sticking with the
> documentation.
The EOF token is necessary. But I think Lemon is correct as
stands - as far as I can tell. Can you please tell me more about
the circumstances of your segfault - specifically where it is
happening.
Well, it doesn't manifest itself in all my test cases, but with the
ones that do crash it's because they end up in a %syntax_error block
with the %extra_argument set to NULL. With the if( yymajor==0 ) check
they parse just fine, never falling into the syntax error block at
all.
You can see the code in question in our Subversion repository:
http://svn.i-want-a-pony.com/repos/etl/trunk
The parser I'm currently seeing fail is src/template/parser.y, and it
happens on most of the input in the test cases (for example,
tests/print/2.etl is causing it). The lexer associated with that
parser is generated by re2c and is in src/template/lexer.re.
(Note that this parser does have a number of parsing conflicts, so
it's certainly possible that I've just done something wrong, but it
"worked" right up until we upgraded to a new version of lemon.c and
lempar.c. The changes to lemon.c were more substantial, so I can't
easily point to a line of code and say "that broke it", but for
lempar.c it seems to come down to that one change.)
Thanks,
-garrett