- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
编译原理 nfa确定化(Compiler principles, NFA, deterministic)
编译原理 nfa确定化(Compiler principles, NFA, deterministic)
*
Experimental purpose:
Deterministic finite automata
Finite (poor) state automata are input and output deterministic finite (finite) state automata
Explain:
Time: 2010/10/37
Author: YFL AHU 09
Sample Input (problem 4.2):
XYZ
01
F
X
Z
F (x, 0) =z
F (y, 0) =x
F (y, 0) =y
F (Z, 0) =x
F (Z, 0) =z
F (x, 1) =x
F (Z, 1) =y
Zero
* /
#include iostream
#include string
#include map
#include set
#include queue
#include algorithm
Using namespace std;
Char, S, f;
String K, E, Z; / / the five tuple M= (K, E, F, S, Z)
String map1[101][101];
Setchar map2[101][101];
Mapchar, int stateNum; / / state in accordance with the corresponding figures
Mapchar, int inputNum; / / in conformity with the corresponding digital input
Mapsetchar, int / setNum;
Setsetchar setSet; / / determined after non final state
Mapsetchar, char strChar; / / rename
Int, N, m;
Char newName =A;
Int, main ()
{
Cout status collection:;
CinK;
Coutendl symbol table:;
CinE;
Coutendl conversion function name:;
Cinf;
Initial coutendl:;
CinS;
Coutendl final state:;
CinZ;
/ / N = K size();
m = E size();
为(int i = 0;i K size();i++){
statenum [我] [ k ] =我;
}
为(int i = 0;i 大肠size();i++){
inputnum [我] [电子] =我;
}
cout endl “转换函数:“ endl;
字符串s;
而(的)!=“0”){
statenum MAP1 [ [ [ 2 ] ] ] [ inputnum [ [ 4 ] ] ]。push_back(S [ 7 ]);
}
字符集的队列setq;
setch字符集;
setch插入(S);
int索引= 0;
setnum [ setch ] =指数+ +;
setset插入(setch);
strchar [ setch ] =新名称+ +;
setq推(setch);
int测试= 0;//
而(!setq。empty()){
测试++;
集字符头= front() setq;
setq。pop();
为(int i = 0;i 大肠size();i++){
设置尾尾;
为(集焦::迭代器iter =头。begin();ITER!=头。();+ + ITER){
字符串S(MAP1 [ statenum [* ITER ] ] [我]);
为(j = 0;J 美国size();j++){
尾.插入(s j);
}
}
MAP2 [ setnum [头] [电子] [我] ] =尾;
如果(!尾巴。empty() 找到(setset。begin(),setset。()、尾)= = setset。
()){
setnum [尾巴] =指数+ +;
setq推(尾);
/ / MAP2 [ setnum [头] [电子] [我] ] =尾;
setset插入(尾);
strchar [尾巴] =新名称+ +;
}
}
}
/ / cout E. size() “***” endl;///////////////
cout “确定化后的表:“ endl;
cout “”;
为(int i = 0;i 大肠si
您可能关注的文档
- 给力流行语(Awesome buzzwords).doc
- 给我七朵花(Give me seven flowers).doc
- 给排水工程中的阀门选用知识(Knowledge of valve selection in water supply and drainage works).doc
- 给我一斤面粉 还你5碗凉皮(Give me a pound of flour do 5 cold noodle bowl).doc
- 给排水说明及工程量计算规则(Specification of water supply and drainage and calculation rules of quantities).doc
- 给系统添加查看ai、psd、cdr、eps图片缩略图功能(Add AI, PSD, CDR and EPS thumbnail images to the system).doc
- 给编程初学者的一些建议(Some suggestions for beginners programming).doc
- 给美容院老板的一封信(A letter to the owner of the beauty salon).doc
- 给花友的养天资料(A date for a friend).doc
- 给药学本科毕业工作、考研迷茫的同学们(For graduates of pharmacy, postgraduate studies, confused students).doc
- 编译原理实验1(Compiler theory experiment 1).doc
- 编译原理源代码 target=_blank(Compiler source code target=_blank).doc
- 编译原理网上作业(Compiler principles online homework).doc
- 编译原理课程设计c 版(Compiler theory, curriculum design, C version).doc
- 编译原理课后习题答案(Compiler principles after-school Exercises answer).doc
- 编译器选项(vs2008)(Compiler options (VS2008)).doc
- 编译的各种参数的解释(project option语法解释)(The interpretation of compiled parameters (project, option, syntax, interpretation)).doc
- 编译词法分析器(Compile lexical analyzer).doc
- 编译预处理和动态存储(Compiling, preprocessing, and dynamic storage).doc
- 缠绕机的分类及其应用(Classification and application of winding machine).doc
文档评论(0)