Chapter 中间代码生成.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Chapter 中间代码生成.ppt

北京化工大学信息科学与技术学院计算机系 北京化工大学信息科学与技术学院计算机系 Chapter 中间代码生成 7.1 Intermediate Code and Data Structures for Code Generation 中间代码和用于代码生成的数据结构 7.2 Basic Code Generation Techniques 基本的代码生成技术 7.3 Code Generation of Control Statements and Logical Expressions 控制语句和逻辑表达式的代码生成 7.4 Code Generation of Procedure and Function Calls 过程和函数调用的代码生成 7.1 Intermediate Code and Data Structures for Code Generation 中间代码和用于代码生成的数据结构 ● intermediate representation ( IR) ● Three-Address Code ● example ● Data Structures for the Implementation of Three-Address Code 实现三地址码的数据结构 ● example ● example ● C code defining possible data structures for the quadruples 四元式的数据结构 7.2 Basic Code Generation Techniques 基本的代码生成技术 ● Practical Code Generation 7.3 Code Generation of Control Statements and Logical Expressions 控制语句和逻辑表达式的代码生成 ● If Statements ● While Statements 7.4 Code Generation of Procedure and Function Calls 过程和函数调用的代码生成 ● example ● example Chapter 中间代码生成 7.1 Intermediate Code and Data Structures for Code Generation 中间代码和用于代码生成的数据结构 7.2 Basic Code Generation Techniques 基本的代码生成技术 7.3 Code Generation of Control Statements and Logical Expressions 控制语句和逻辑表达式的代码生成 7.4 Code Generation of Procedure and Function Calls 过程和函数调用的代码生成 Thank you. ? Beijing University of Chemical Technology Beijing,?P R China * * 7 A data structure that represents the source program during translation is called an intermediate representation, or IR, for short. 源程序的一种内部表示,不依赖目标机的结构,易于生成目标代码的中间表示。 ● two popular forms of intermediate code Three-Address Code三地址码 波兰式 P-code. P-代码 例1 请写出算术表达式 2*a+(b-3) 的三地址码 解: 2*a+(b-3) with syntax tree 2*a+(b-3) 的语法树 + b * - 3 2 a T1 = 2 * a T2 = b – 3 T3 = t1 + t2 (2) The corresponding three-address code is 三地址码 例2 请写出Sample TINY program的三地址码 read x ; { input an integer } if 0 x then { don’t compute if x = 0 } fact:=1; repeat fact:=fact*x; x:=x-1 until x=0; write fact { output factorial of x } ends 解:Three-address code for the

文档评论(0)

shengyp + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档