Including files from Yacc/Bison definitions header (x.tab.h)
Posted on 2005-04-29
I'm generating a scanner-parser pair with Flex and Bison (similar to Lex and Yacc respectively). My YYSTYPE is a union which, as one of its members, has a struct*.
Bison generates its definitions file 'x.tab.h' containing all of the token definitions, etc. but I have the problem that when I include it from my Flex scanner (x.l) and try to compile the resulting file, the struct* is an undefined type. Is there a way I can get Bison to a #include into the header file it generates?
I can work around this problem by including the file in x.l *before* I include x.tab.h, but I would consider that a bad practice - the header file should be complete on its own.
Anybody know of how to do this?