编译原理实验报告

编译原理实验报告

ID:17976136

大小:163.00 KB

页数:14页

时间:2018-09-12

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

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

1、编译原理实验报告姓名:***班级:***学号:***指导老师:***otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeA

2、fterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand实验一编译程序的分析与验证一、实验目的:熟练掌握LR分析

3、表以及编译原理的基本过程,学会分析编译程序。二、实验要求:理论联系实际,将所学知识用到实处。上机实验,验证老师给的代码的正确性,进而学会怎么写编译程序。三、实验内容:验证自己的文法的正确性,识别文法中的单词、句子、关键字、变量,等等。验证下述程序输出结果的正确性:while(a>b)dobeginifm>=nthena:=a+1elsewhilek=hdox:=x+2;m:=n+x*(m+y)end#~四、程序部分代码:#include"stdio.h"#include"string.h"#defi

4、neACC-2/**************************************/#definesy_if0#definesy_then1#definesy_else2#definesy_while3#definesy_begin4#definesy_do5#definesy_end6#definea7#definesemicolon8#definee9#definejinghao10#defineS11#defineL12#definetempsy15#defineEA18#defin

5、eE019#defineplus34#definesub35#definetimes36otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecial

6、CommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand#definediv37#defin

7、ebecomes38#defineop_and39#defineop_or40#defineop_not41#definerop42#definelparent48#definerparent49#defineident56#defineintconst57/********************算术表达式的LR分析表********************/staticintaction1[14][9]={{-1,-1,-1,-1,2,-1,3,-1,1},{4,5,6,7,-1,-1,-1,A

8、CC,-1},{-1,-1,-1,-1,2,-1,3,-1,8},{106,106,106,106,-1,106,-1,106,-1},{-1,-1,-1,-1,2,-1,3,-1,9},{-1,-1,-1,-1,2,-1,3,-1,10},{-1,-1,-1,-1,2,-1,3,-1,11},{-1,-1,-1,-1,2,-1,3,-1,12},{4,5,6,7,-1,13,-1,-1,-1},{101,101,101,101,-1,101,-1,101,-1},{

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

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

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