can ne1 tell me line by line what this code is doing?
I have to implement it and still I am confused about its functionality.Basically its reading frem a file containig this.
File contents::
Code:Function: S(q0, a) = q1, S(q0, b) = q3, S(q1, a) = q2, S(q2, b) = q1, S(q3, a) = q2, S(q2, b) = q1, S(q2, b) = q4, S(q1, b) = q4, S(q3, b) = q4, S(q2, a) = q3, S(q4, a) = q4, S(q4, b) = q4, S(q3, a) = q2. code::::: strcpy(temp2,"Function"); if (strcmp(temp,temp2)==0) { transitions= new int*[numStates]; for(i=0;i<numStates;i++) { transitions[i]=new int[numAlphabets]; } // intializing the transition table with values.. -1 shows trap state for (i=0;i<numStates;i++) { for (j=0;j<numAlphabets;j++) { transitions[i][j]=-1; } } dfa1File.getline(temp,500,'.\n'); int i=0,x=0,y=0,z=0; char* token; int buffer[200]; token = strtok( temp, ":,\n."); while( token != NULL ) { x=token[4]-48; token = strtok( NULL, ":,\n."); y=token[1]-97; z=token[7]-48; transitions[x][y]=z; token = strtok( NULL, ":,\n."); i++; } }



LinkBack URL
About LinkBacks



