//File parser.h #ifndef PARSERH #define PARSERH #include "TokFiler.h" #include "QuadList.h" #include "QuadFiler.h" #include "FileManager.h" #include "Token.h" #include "pmglobs.h" #include "intstack.h" #include "idDescTab.h" #include "funcTab.h" #include "Quad.h" const BASE=2; const NILADDR=-2000; const EMPTY=0; enum classes { identclass=1,numclass=2,boolclass=3,tempclass=4,linenumclass=10 }; class parser { private: TokFiler tf; FileManager pf; QuadFiler qf; char tfname[STRSIZE]; int Quadnum; int linenumber; QuadList* qlist; stack s; stack qs; idDescTable iddt; idFuncTable ft; attributes attribs; funcAttributes fattribs; int vcnt,vcntprime,pcnt; int temp,level,localmax,localtempsmax; int startaddrforglobaltemps,startaddrforlocaltemps; int varmax,varcnt; Token null; public: parser(); ~parser() {delete qlist;}; void displayStack() {s.display(); }; void displayQStack() {qs.display(); }; void error(unsigned int n, unsigned int line); intconst getintok(Token tok); void Tokensequence(); void getopndinfo(Token& opnd, int& lev,int& type,bool& func); void freetempaddrs(); int alloctempaddr(); void createHALTQuad(); void createIOQuad(int oper); void createASSIGNQuad(); void createARITHQuad(int oper); void createBOOLQuad(); void createNOTQuad(); void createANDQuad(); void createODDQuad(); void createJUMPQuad(int oper); void createfuncASPQuad(); void createfuncFSPQuad(); void createRTNQuad(); void savePROGinfo(); void saveVARinfo(); void saveFUNCinfo(); void FORMALparam(); void ACTUALparam(); void Fcallret(); void emitallQuads(); void seeQuads() {qf.seeQuadFile();}; void distributeProgName(char* pName); void getProgramFile() { pf.retrieveProgram(pf.getProgramName()); }; void getTokenFile() { tf.retrieveTokenFile(); }; void seeTokens() {tf.seeTokenFile(); }; void seeProgramFile() {pf.seeProgramFile(); }; void closeProgramFile() {pf.closeProgram(); }; void closeTokenFile() {tf.closeTokenFile(); }; }; #endif //Page: B-25