/* Function buildSymtab constructs the symbol * table by preorder traversal of the syntax tree */ void buildSymtab(TreeNode * syntaxTree) { traverse(syntaxTree,insertNode,nullProc); if (TraceAnalyze) { fprintf(listing,"\nSymbol table:\n\n"); printSymTab(listing); } }
/*constructs the symbol table by preorder traversal of the syntax tree*/ int buildSymtab(TreeNode* syntaxTree) { offset = -4; traverse(syntaxTree); //printf("here %d \n",TraceAnalyze); if(TraceAnalyze) { fprintf(listing, "\nSymbol table:\n\n"); printSymTab(listing); } return -offset; }
/* Function buildSymtab constructs the symbol * table by preorder traversal of the syntax tree */ void buildSymtab(TreeNode * syntaxTree) { globalScope = sc_create(NULL); sc_push(globalScope); insertIOFunc(); traverse(syntaxTree,insertNode,afterInsertNode); sc_pop(); if (TraceAnalyze) { fprintf(listing,"\nSymbol table:\n\n"); printSymTab(listing); } }
/* Function buildSymtab constructs the symbol * table by preorder traversal of the syntax tree */ void buildSymtab(TreeNode * syntaxTree) { initSymTab(); traverse(syntaxTree,insertNode,nullProc); if (TraceAnalyze) { int funcI; for(funcI=0;funcI<MAXFUNCAMT;funcI++) { if(location[funcI]==0) { continue; } fprintf(listing,"\nSymbol table %d:\n\n", funcI); st_setCurFuncNum(funcI); printSymTab(listing); } } a_curFuncNum=0; st_setCurFuncNum(0); }
void visitProgramImpl(ProgramImpl *p) { p->visit_children(this); string x = "Program"; char* a = strdup("Program"); ClassName * cName = new ClassName(a); if(!m_classtable->exist(cName)){ t_error(no_program, p->m_attribute); } ClassNode* classnode = m_classtable->lookup(cName); SymScope * sync = classnode->scope; char * s = strdup("start"); // char * methodName = (s); Symbol * f= sync->lookup(s); if((f == NULL) || (f->methodType.returnType.baseType != 16)){ t_error(no_start, p->m_attribute); } if(f->methodType.argsType.size() != 0){ t_error(start_args_err, p->m_attribute); } printSymTab(); //WRITE ME }