Change filename: def.y to def.yy def.y ->def.tab.c , def.tab.h def.yy->def.tab.cc, def.tab.hh change Makefile: def.y def.tab.c , | | V V def.yy def.tab.cc, new variable: CPP=g++ change CC -> CPP in two places: def.tab.cc compilation whole program compilation add some code at begin of this file def.yy: extern "C" int yylex(); extern "C" int yyerror(const char *msg, ...); using namespace std; change function parameters at two places of *.l: int yyerror(const char *msg, ...); int yyerror(const char *msg, ...){