Compiler_mean3.rar

上传者: qinglingls | 上传时间: 2019-12-21 20:29:29 | 文件大小: 76KB | 文件类型: rar
input.txt是输入的测试文件。 produce.txt是输入的LR1产生式,能力不大,能if,while,赋值,加,乘,不能处理任何嵌套,没有数组,(这个你可以自己加文法进去进行处理) Grammar.txt是某个博客上的文法,看着很靠谱,但是我没有再做测试的心思了。。。 这个程序没啥bug,但是文法如果有左递归,那肯定是会出现stack overflow的(书上算法就是这么设计的) 另外LR文法不能有二义性,你得在文法里面把算术优先级给解决了。 另外如果加入嵌套,那必然复杂度指数上升,得跑很久。。。。十分钟似乎都不算多。。 运行指南: gui.JtableParse3.java 显示LR1分析表,同时对input里面的文件进行分析。输出词法分析结果到output.txt 输出规约过程,很小一段语句可能就会很长的规约过程。 letex.LexResult.java 显示词法分析结果。输出全部识别出来的单词。 LR1识别实现完全在Parse3包里,自己看名字去读代码。 几乎每一个主要的类我都写了main()方法,可以自己输入一些产生式去试下, 比如书上给的: S' -> S S -> C C C -> c C|d 得到的集合和LR1的结果和书上完全一致 和一些网址上的 S' -> S S -> L = R S -> R L -> * R L -> id R -> L 你可以通过跑ItemTable.java 得到全部的集合和goto集合, 通过跑gotoTable.java 得到goto表 通过跑ActionTable.java 得到action表(cmd形式) 通过跑parse.java 得到两张表的合集和规约过程。 gui.JtableParse3.java 把上面的两张表合在一起图形化了。 我鼓励你发现我的bug *0*虽然我不一定会决定去修改它, 但你可以发布修复bug的最新版本。注意标明原转载网址奥。 更加详细的思路和其他的说明,见下面的网址: https://blog.csdn.net/qinglingLS 和: https://blog.csdn.net/qinglingLS/article/details/89814398 【HIT哈工大编译原理实验】词法分析程序java 【编译原理】求first集合的代码实现java 【编译原理】求GOTO图的代码实现java 【编译原理】LL(1)分析法代码 其他的更新版本可以自己去博客里找一下噢。 写于2019/5/8

文件下载

资源详情

[{"title":"( 47 个子文件 76KB ) Compiler_mean3.rar","children":[{"title":"Compiler_mean3","children":[{"title":"OUTPUT.c <span style='color:#111;'> 301.03KB </span>","children":null,"spread":false},{"title":".project <span style='color:#111;'> 390B </span>","children":null,"spread":false},{"title":"produce.txt <span style='color:#111;'> 807B </span>","children":null,"spread":false},{"title":"src","children":[{"title":"utils","children":[{"title":"FileOpt.java <span style='color:#111;'> 1.98KB </span>","children":null,"spread":false}],"spread":true},{"title":"parse3","children":[{"title":"Item.java <span style='color:#111;'> 15.53KB </span>","children":null,"spread":false},{"title":"Parse.java <span style='color:#111;'> 5.26KB </span>","children":null,"spread":false},{"title":"ItemSet.java <span style='color:#111;'> 2.11KB </span>","children":null,"spread":false},{"title":"LRClosure.java <span style='color:#111;'> 8.10KB </span>","children":null,"spread":false},{"title":"GoTo.java <span style='color:#111;'> 1.21KB </span>","children":null,"spread":false},{"title":"FirstFollow.java <span style='color:#111;'> 8.97KB </span>","children":null,"spread":false},{"title":"GoToTable.java <span style='color:#111;'> 4.26KB </span>","children":null,"spread":false},{"title":"WordStack.java <span style='color:#111;'> 904B </span>","children":null,"spread":false},{"title":"ActionTable.java <span style='color:#111;'> 7.31KB </span>","children":null,"spread":false},{"title":"ItemTable.java <span style='color:#111;'> 5.47KB </span>","children":null,"spread":false},{"title":"ProductionList.java <span style='color:#111;'> 3.50KB </span>","children":null,"spread":false},{"title":"Production.java <span style='color:#111;'> 1.14KB </span>","children":null,"spread":false}],"spread":false},{"title":"gui","children":[{"title":"JTableParse3.java <span style='color:#111;'> 4.53KB </span>","children":null,"spread":false}],"spread":true},{"title":"letex","children":[{"title":"KeyWord.java <span style='color:#111;'> 1.80KB </span>","children":null,"spread":false},{"title":"LexAnalyse.java <span style='color:#111;'> 18.32KB </span>","children":null,"spread":false},{"title":"LexResult.java <span style='color:#111;'> 3.77KB </span>","children":null,"spread":false},{"title":"Tag.java <span style='color:#111;'> 2.38KB </span>","children":null,"spread":false},{"title":"Word.java <span style='color:#111;'> 832B </span>","children":null,"spread":false},{"title":"Token.java <span style='color:#111;'> 239B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"input.c <span style='color:#111;'> 210B </span>","children":null,"spread":false},{"title":"说明.txt <span style='color:#111;'> 1.68KB </span>","children":null,"spread":false},{"title":"Grammar.txt <span style='color:#111;'> 2.73KB </span>","children":null,"spread":false},{"title":".classpath <span style='color:#111;'> 232B </span>","children":null,"spread":false},{"title":"bin","children":[{"title":"utils","children":[{"title":"FileOpt.class <span style='color:#111;'> 2.44KB </span>","children":null,"spread":false}],"spread":true},{"title":"parse3","children":[{"title":"ItemSet.class <span style='color:#111;'> 2.88KB </span>","children":null,"spread":false},{"title":"GoToTable.class <span style='color:#111;'> 5.18KB </span>","children":null,"spread":false},{"title":"Item.class <span style='color:#111;'> 9.71KB </span>","children":null,"spread":false},{"title":"ProductionList.class <span style='color:#111;'> 4.03KB </span>","children":null,"spread":false},{"title":"Parse.class <span style='color:#111;'> 5.71KB </span>","children":null,"spread":false},{"title":"WordStack.class <span style='color:#111;'> 1.72KB </span>","children":null,"spread":false},{"title":"FirstFollow.class <span style='color:#111;'> 5.14KB </span>","children":null,"spread":false},{"title":"LRClosure.class <span style='color:#111;'> 5.68KB </span>","children":null,"spread":false},{"title":"ActionTable.class <span style='color:#111;'> 6.95KB </span>","children":null,"spread":false},{"title":"Production.class <span style='color:#111;'> 1.89KB </span>","children":null,"spread":false},{"title":"ItemTable.class <span style='color:#111;'> 4.55KB </span>","children":null,"spread":false},{"title":"GoTo.class <span style='color:#111;'> 1.61KB </span>","children":null,"spread":false}],"spread":false},{"title":"gui","children":[{"title":"JTableParse3.class <span style='color:#111;'> 4.75KB </span>","children":null,"spread":false}],"spread":true},{"title":"letex","children":[{"title":"Token.class <span style='color:#111;'> 517B </span>","children":null,"spread":false},{"title":"LexResult.class <span style='color:#111;'> 5.21KB </span>","children":null,"spread":false},{"title":"Tag.class <span style='color:#111;'> 2.58KB </span>","children":null,"spread":false},{"title":"LexAnalyse.class <span style='color:#111;'> 9.89KB </span>","children":null,"spread":false},{"title":"KeyWord.class <span style='color:#111;'> 2.43KB </span>","children":null,"spread":false},{"title":"Word.class <span style='color:#111;'> 1.19KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明