#include<stdio.h> #include <ctype.h> #define ok 1 #define error 0 #define MAXREGLUARLONG 40 #define MAXSTATELONG 40 #define MAXCAHRSLONG 40 typedef int state; int iCurrentState=0; //初态以1开始 int iPreState=0; int iLastForkState=0; int iForkState=0; int iMaxState=0; char cRegluarSting[MAXREGLUARLONG]; //输入的正规式字符串 char cCharSet[MAXCAHRSLONG]; //字符集 int iStateMatrix[MAXSTATELONG][MAXCAHRSLONG]; //状态转换矩阵 state vStoreRegluarSting()//把字符串读入一个缓冲区中 { scanf("%s",cRegluarSting); return ok; } state vPreProcessRegluarSting()//对字符串进行预处理,去掉字符串里面的对分析不产生影响 { int i=0; while(cRegluarSting[i]!='