void compileConstDecls(void) { // TODO if(lookAhead->tokenType == TK_IDENT) { compileConstDecl(); compileConstDecls(); } //else //error(ERR_INVALIDCONSTDECL, lookAhead->lineNo, lookAhead->colNo); }
void compileBlock(void) { compileConstDecls(); compileTypeDecls(); compileVarDecls(); compileSubDecls(); eat(KW_BEGIN); compileStatements(); eat(KW_END); }
void compileBlock(void) { assert("Parsing a Block ...."); if (lookAhead->tokenType == KW_CONST) { eat(KW_CONST); compileConstDecl(); compileConstDecls(); compileBlock2(); } else compileBlock2(); assert("Block 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 compileConstDecls(void) { // TODO switch (lookAhead->tokenType) { case TK_IDENT: compileConstDecl(); compileConstDecls(); break; // EmptySt needs to check FOLLOW tokens case KW_TYPE: case KW_VAR: case KW_BEGIN: case KW_FUNCTION: case KW_PROCEDURE: break; // Error occurs default: error(ERR_INVALIDCONSTDECL, lookAhead->lineNo, lookAhead->colNo); break; } }