#include #include struct node { int st; struct node *link; }; struct node1 { int nst[20]; }; void insert(int ,char, int); int findalpha(char); void findfinalstate(void); int insertdfastate(struct node1); int compare(struct node1,struct node1); void printnewstate(struct node1); static int set[20],nostate,noalpha,s,notransition,nofinal,start,finalstate[20],c,r,buffer[20]; int complete=-1; char alphabet[20]; static int eclosure[20][20]={0}; struct node1 hash[20]; struct node * transition[20][20]={NULL}; void main() { int i,j,k,m,t,n,l; struct node *temp; struct node1 newstate={0},tmpstate={0}; printf("Enter the number of alphabets?\n"); printf("NOTE:- [ use letter e as epsilon]\n"); printf("NOTE:- [e must be last character ,if it is present]\n"); printf("\nEnter No of alphabets and alphabets?\n"); scanf("%d",&noalpha); getchar(); for(i=0;i qno alphabet qno]\n",notransition); printf("NOTE:- [States number must be greater than zero]\n"); printf("\nEnter transition?\n"); for(i=0;ist]==0) { c++; set[temp->st]=temp->st; } temp=temp->link; } } } printf("\n"); if(c!=0) { for(m=1;m<=nostate;m++) tmpstate.nst[m]=set[m]; insertdfastate(tmpstate); printnewstate(newstate); printf("%c\t",alphabet[k]); printnewstate(tmpstate); printf("\n"); } else { printnewstate(newstate); printf("%c\t", alphabet[k]); printf("NULL\n"); } } } printf("\nStates of DFA:\n"); for(i=0;i<=complete;i++) printnewstate(hash[i]); printf("\n Alphabets:\n"); for(i=0;ist=s; temp->link=transition[r][j]; transition[r][j]=temp; } int findalpha(char c) { int i; for(i=0;i