DFAContentModel::DFAContentModel( const bool dtd , ContentSpecNode* const elemContentSpec , const bool isMixed , MemoryManager* const manager): fElemMap(0) , fElemMapType(0) , fElemMapSize(0) , fEmptyOk(false) , fEOCPos(0) , fFinalStateFlags(0) , fFollowList(0) , fHeadNode(0) , fLeafCount(0) , fLeafList(0) , fLeafListType(0) , fTransTable(0) , fTransTableSize(0) , fDTD(dtd) , fIsMixed(isMixed) , fLeafNameTypeVector(0) , fMemoryManager(manager) { // And build the DFA data structures buildDFA(elemContentSpec); }
int main(){ printf("******* INTIATING COMPILER ***********\n"); //printf("Choose Relevant stage of compiler:\n"); //printf("1. Lexical Analysis\n"); //printf("2. Parsing\n"); //printf("3. Semantic Analysis\n"); //printf("4. Code Generation\n"); int choice,i; char c; if(1){ hashTable* T = build_hash(); // build the hash table to maintain state of tokens printStoreHash(T); // store hashTable in a file Dnode* DFA = buildDFA(); memset(LexicalUnits,'\0',sizeof(LexicalUnits)); lexerCode(DFA,T,LexicalUnits,tokenValue,line); printf("\nLexer tokens have been generated in Lexer Tokens.txt\n"); pnode* root=NULL; root=parse(LexicalUnits,tokenValue,line); printf("\nParse tree generated in parseTree.txt\n"); pnode* ast=getAST(root); printf("\nAbstarct Syntax Tree Generated in AbstractSyntaxTree.txt\n"); Master *sym = (Master*)malloc(sizeof (Master)); getSymbolTable(sym,ast); printf("\nSymbol Table Generated in symbolTable.txt\n"); GenerateCode(sym,ast); printf("\nCode Generation Successfull\n\n"); } return 0; }
int main() { freopen("Text/LCS2.txt","r",stdin); int i, k = 0, m = 0, res = 0; while(fgets(ss[k], MAX, stdin)) { len[k] = strlen(ss[k])-1; if(len[k] < len[m]) m = k; k++; } buildDFA(m); n1 = len[m]; for(i = 0; i < cnt; i++) { a[i].len = st[i].len; a[i].idx = i; } std::sort(a, a + cnt, comp); for(i = 0; i < cnt; i++) { //printf("LLLL\t%d\t%d\n",a[i].len,a[i].idx); b[i] = a[i].idx; } for(i = 0; i < k; i++) { if(i != m) lcs(i); } for(i = 0; i < cnt; i++) { setmax(res,st[i].w); } printf("%d\n", res); return 0; }