#include <stdio.h>#include<string.h>#include<stdlib.h>#defineMAX 101intn=1;voidTackback (CharCh[],intStartintEndintBegain,intfinal);intMain () {CharCh[max]; intsize; scanf ("%s", CH); Size=strlen (CH); Tackback (CH,0, size,0,1); return 0;}voidTackback (CharCh[],intStartintEndintBegain,intfinal) { intI=start; while(! (Ch[i] = ='|') && i<end) I++; if(ch[i]=='|') {tackback (ch,start,i-1, begain,final); Tackback (Ch,i+1, end,begain,final); } I=start; //printf ("start=%d\tend=%d\n", start,end); if(ch[i]>='a'&& ch[i]<='Z') { if(ch[i+1]=='.') {n++; printf ("f<%d,%c>=%d\n", Begain,ch[i],n); } Else if(ch[i+1]=='*') {n++; printf ("f (%d,~) =%d\n", Begain,n); printf ("f (%d,~) =%d\n", n,final); printf ("f (%d,%c) =%d\n", N,ch[i],n); }} I+=2; while(i<end) { if(ch[i]>='a'&& ch[i]<='Z') { if(ch[i+1]=='.') {printf ("f<%d,%c>=%d\n", n,ch[i],n+1); N++; } Else if(ch[i+1]=='*') {n++; printf ("f (%d,~) =%d\n", Begain,n); printf ("f (%d,~) =%d\n", n,final); printf ("f (%d,%c) =%d\n", N,ch[i],n); }} I++; } if(ch[i]>='a'&& ch[i]<='Z') { if(ch[i+1]=='*') {printf ("f (%d,%c) =%d\n", n,ch[i],final); } Else{printf ("f<%d,%c>=%d\n", n,ch[i],final); } }}
Experimental results
Construction and identification of experimental three-finite automata