递归下降分析 (51).ppt

上传人:刘静 文档编号:84102360 上传时间:2023-04-01 格式:PPT 页数:7 大小:93.29KB
返回 下载 相关 举报
递归下降分析 (51).ppt_第1页
第1页 / 共7页
递归下降分析 (51).ppt_第2页
第2页 / 共7页
点击查看更多>>
资源描述

《递归下降分析 (51).ppt》由会员分享,可在线阅读,更多相关《递归下降分析 (51).ppt(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、Compiler ConstrucionS1Three-Address CodeThe most basic instruction of three address codex=y op zThe use of the address x differs from the addresses of y and z.y and z can represent constants and literal values.Compiler ConstrucionS2Form of Intermediate CodeIntermediate code is a linearization of the

2、 syntax tree.Intermediate code Can be very high level,representing operations almost as abstractly as the syntax tree or can closely resemble target code.May use or not used detailed information about the target machine and runtime environment.Compiler ConstrucionS3Example2*a+(b-3)+*-2ab3t1=2*at2=b-

3、3t3=t1+t2t1=b-3t2=2*at3=t2+t1Left-to-right linearization Right-to-left linearization Compiler ConstrucionS4Three-Address Code(cont)It is necessary to vary form of the three-address code to express all constructs(e.g.t2=-t1)No standard form exists.Compiler ConstrucionS5Implementation of Three-Address

4、 CodeEach three-address instruction is implemented as a record structure containing several fields.The entire sequence is an array or a linked list.The most common implementation requires four fields quadruple One for operation and three for addresses.For instructions that need fewer number of addre

5、sses,one or more addresses fields is given null or“empty”values.Compiler ConstrucionS6Factorial Program Sample program in TINY language-computes factorial read x;input an integer if 0 x then dont compute if x=0 fact:=1;repeat fact:=fact*x;x:=x-1 until x=0;write fact output factorial of x endCompiler ConstrucionS7Syntax Tree for Factorial Program

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 大学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁