Change the patch to tg.y, so the resulting y.tab.c compiles on both Yacc (on
FreeBSD), and Bison (on CygWin, and presumably Linux.) Details: The #include lex.yy.c in tg.y used to be in the epilog code, after the second %% line. This worked in Yacc, which generates the yyparse() function at the end. But it caused many identifiers to be used before known in Bison, which puts the yyparse() function in the middle where the rules are. Moving the #include lex.yy.c to the prolog, before the %} line, fixed things in Bison, but left yylex and yylval undefined at the crucial moments in Yacc. I added the necessary forward declarations in the prolog and epilog and now it builds on both flavors.