#ifndef _CODEGEN #define _CODEGEN #include using namespace std; // defined in espresso.y extern Program *ast; // defined in espresso.y extern StringTab stringtab; // defined in espc.cc extern bool codegenDebug; // encapsulates vars needed for code generation // and algs used. // the constuctor passes in : // the ast for the program to analyze, // the class symbol table, // and the file to write instructions to // genCode generates code for the ast class CodeGen { public: CodeGen(Program *ast, ClassTable *classTable, ostream &assemFile); void genCode(); private: Program *ast; ClassTable *classSymTab; ostream &outFile; // add more fields here as needed }; #endif