📄 main.c
字号:
//main.c
#include "RND.h"
void main()
{
/* ________________初始化操作________________*/
fpout=fopen(FileOutputPath,"w");
if (!Readalphabet())
{
printf(" Error in opening files: alphabet.txt . Please check it. \n");
exit(1);
}
if (!Readregexp())
{
printf(" Error in opening files: regexp.txt . Please check it.\n");
exit(1);
}
if (!LexScan(Regexp))//判断正则表达式是否符合要求
{
printf(" The regular express is illegal, please check it! \n");
exit(1);
}
else
printf(" Lexical scan passed, The regular express is legel.\n");
fprintf(fpout," Lexical scan passed, The regular express is legel.\n");
AddConcatenation();//正则式加入连接符“+”
REtoPostfix();//转化为后缀表达式
/* ________________RegExp==>NFA________________*/
/*构造NFA__采用Thompson's Algorithm*/
Nfa=(NFA *)malloc(sizeof(NFA));
Init_Nfa();
ConstructNFA();//Thompson's Algorithm核心算法
OutputNFA();//输出NFA图
/* ________________NFA==>DFA________________*/
ConstructDFA();//将NFA生成对应的DFA__子集构造法
OutputDFA();//输出DFA
printf(" _______________________________End_________________________________ \n ");
fprintf(fpout," _______________________________End_________________________________\n ");
fclose(fpout);
printf(" You can see all above in the Report.txt at the same path Please press Enter to exit!\n");
getchar();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -