void compileSubDecls(void) { assert("Parsing subtoutines ...."); // TODO if (lookAhead->tokenType == KW_FUNCTION) { compileFuncDecl(); compileSubDecls(); } else if (lookAhead->tokenType == KW_PROCEDURE) { compileProcDecl(); compileSubDecls(); } assert("Subtoutines parsed ...."); }
void compileSubDecls(void) { assert("Parsing subtoutines ...."); // TODO if(lookAhead->tokenType==KW_FUNCTION) { compileFuncDecl(); compileSubDecls(); } else if(lookAhead->tokenType==KW_PROCEDURE) { compileProcDecl(); compileSubDecls(); } //else //error(ERR_INVALIDSUBDECL, lookAhead->lineNo, lookAhead->colNo); assert("Subtoutines parsed ...."); }
void compileBlock(void) { compileConstDecls(); compileTypeDecls(); compileVarDecls(); compileSubDecls(); eat(KW_BEGIN); compileStatements(); eat(KW_END); }
void compileSubDecls(void) { assert("Parsing subtoutines ...."); // TODO switch(lookAhead->tokenType){ case KW_FUNCTION: compileFuncDecl(); compileSubDecls(); break; case KW_PROCEDURE: compileProcDecl(); compileSubDecls(); break; case KW_BEGIN: break; default: error(ERR_INVALIDSUBDECL,lookAhead->lineNo,lookAhead->colNo); break; } assert("Subtoutines parsed ...."); }
void compileBlock(void) { Instruction* jmp; jmp = genJ(DC_VALUE); compileConstDecls(); compileTypeDecls(); compileVarDecls(); compileSubDecls(); updateJ(jmp,getCurrentCodeAddress()); genINT(symtab->currentScope->frameSize); eat(KW_BEGIN); compileStatements(); eat(KW_END); }
void compileBlock(void) { Instruction* jmp; // Jump to the body of the block jmp = genJ(DC_VALUE); compileConstDecls(); compileTypeDecls(); compileVarDecls(); compileSubDecls(); // Update the jmp label updateJ(jmp,getCurrentCodeAddress()); // Skip the stack frame genINT(symtab->currentScope->frameSize); eat(KW_BEGIN); compileStatements(); eat(KW_END); }
void compileBlock4(void) { compileSubDecls(); compileBlock5(); }