It's not easy to tell the exact problem without seeing more of your file, but it's certainly not the case that
The first line was successfully parsed and should be popped off the stack
The stack at the point of the error looks like this:
statementlist KW_CONFIGPARAM
where statementlist
was created by the reduction of the first line, as reported by bison.
You don't seem to be specifying a value for statement_list; if you excerpt is literal, then it will have been compiled as though it had been written:
statementlist : statement ';' {$0 = $1;}
I can't tell what the value corresponding to statement
was, but it is certainly conceivable that it includes the string "p"
. That depends on what you set $0
to during { /* do some stuff, create a new ConfigParam object */ }
.
(Moved from a comment once it became evident that it's somewhat close to the right answer.)
My other idea is this: Perhaps you've made all of your terminals and non-terminals have a type which triggers that destructor. And maybe your lexer does not modify yylval
when it returns KW_CONFIGPARM
. In that case, the bison parser cannot know that yylval
is irrelevant, so it will use the left over yylval
(which is a pointer to "p"
).