Hello,
I would like to generate a lexer with debug functionality. I'm relying on a slightly modified versions of the sources:
As far as I can tell, my issues are not related to the fact that I'm working with a slightly modified version, but I thought I'll mention it just to be on the safe side.
The first issue was that the debug information collected in fdebug
was not flushed and as a result the y.debug file for the lexer kept showing up empty. I had to add Bterm(fdebug);
at the end of the main()
in yacc.c to get the y.debug file to be generated with content.
Now, my issue is that if I'm compiling the generated lex.yy.c with -DLEXDEBUG
I get:
undefined reference to `allprint(char)'
because of sections like the one below:
# ifdef LEXDEBUG
if(debug){
fprintf(yyout,"char ");
allprint(yych);
putchar('\n');
}
# endif
The allprint()
function is defined in the Lex source sub1.c. It seems I'd have to link against the Lex source to be able to compile lex.yy.c in debug mode, which would be a bit complicated as there are some clashes with my other application. Other complications are caused by the global variables that show up in allprint()
and other functions that are listed in the DEBUG
section of sub1.c.
Can someone point me in the right direction, or tell me what am I missing here?
Thanks!
Gyorgy