lex error y.tab.h
14,497
the "y.tab.h" file included in the flex file is generated when you run bison with -dy. example:
flex mylex.l
bison -dy myparser.y
then you should compile them both together:
gcc lex.yy.c myparser.tab.c -o mycompiler.exe
Author by
codenamejupiterx
Updated on October 09, 2022Comments
-
codenamejupiterx over 1 year
I am trying to get this example code working but i keep getting the error: fatal error: 'y.tab.h' file not found #include "y.tab.h" . What can I do about this?
%{ #include <stdlib.h> void yyerror(char *); #include "y.tab.h" %} %% [0-9]+ { yylval = atoi(yytext); return INTEGER; } [-+\n] return *yytext; [ \t] ; /* skip whitespace */ . yyerror("invalid character"); %% int yywrap(void) { return 1; }