编译原理实验报告

编译原理实验报告

ID:18193063

大小:243.00 KB

页数:27页

时间:2018-09-15

编译原理实验报告_第1页
编译原理实验报告_第2页
编译原理实验报告_第3页
编译原理实验报告_第4页
编译原理实验报告_第5页
资源描述:

《编译原理实验报告》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、中南林业科技大学实验报告课程名称:编译原理专业班级:2011级计算机科学与技术1班姓名:朱斌俊学号:201143902014年6月30日forthequalityofreviewsandreview.Article26threview(a)theCCRAcompliance,whethercopiesofchecks;(B)whetherdoubleinvestigation;(C)submissionofprogramcompliance,investigationorexaminationofwhetherview

2、sareclear;(D)theborrower,guarantorloans实验一词法分析器的设计一、实验目的设计词法分析器二、设计方法:1.写出该语言的词法规则。2.把词法规则转换为相应的状态转换图。3.把各转换图的初态连在一起,构成识别该语言的自动机4.设计扫描器5.把扫描器作为语法分析的一个过程,当语法分析需要一个单词时,就调用扫描器。6.扫描器从初态出发,当识别一个单词后便进入终态,送出二元式。forthequalityofreviewsandreview.Article26threview(a)theCCR

3、Acompliance,whethercopiesofchecks;(B)whetherdoubleinvestigation;(C)submissionofprogramcompliance,investigationorexaminationofwhetherviewsareclear;(D)theborrower,guarantorloans三、实验结果输入:输出:四、实验代码#include#include#include#include#incl

4、udeusingnamespacestd;forthequalityofreviewsandreview.Article26threview(a)theCCRAcompliance,whethercopiesofchecks;(B)whetherdoubleinvestigation;(C)submissionofprogramcompliance,investigationorexaminationofwhetherviewsareclear;(D)theborrower,guarantorloans

5、#defineIPTFcin#defineOPTFcout//inputflowstructWordType{stringstr;inttype;WordType(strings,intt){str=s,type=t;}};booloperator<(strings1,strings2){returns1.compare(s2)<0;}//小于重载classTL{public:mapmp;vectorres;//翻译结果stringstrCache;intcacheLen;/

6、/已经读取的数据TL();boolinit();boolprintFile();booltranslate();chargetChar();//获取字符charpeek();//探测stringgetWord();//booltranslateWordByMap(stringstr);//使用map翻译private:boolisLetter(charch){return(ch>='a'&&ch<='z')

7、

8、(ch>='A'&&ch<='Z');}boolisNum(charch){return(ch>='0'&&c

9、h<='9');}};TL::TL(){}boolTL::init(){mp.clear();ifstreammpf("mapFile.txt",ios::in);if(!mpf)forthequalityofreviewsandreview.Article26threview(a)theCCRAcompliance,whethercopiesofchecks;(B)whetherdoubleinvestigation;(C)submissionofprogramcompliance,investigationorex

10、aminationofwhetherviewsareclear;(D)theborrower,guarantorloans{cerr<<"openerror!"<>type){while(mpf>>str&&str.compare("#end")

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。