第6章 语义的的分析及中间代码生成.ppt

  1. 1、本文档共129页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
* * * * * * * * * * * * * * * * * * * * * * 学习动物精神 12、善解人意的海豚:常常问自己:我是主管该怎么办才能有助于更好的处理事情的方法。在工作上善解人意, 会减轻主管、共 事者的负担,也 让你更具人缘。 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 6.6.1 布尔表达式的回填式翻译 B ? B1 and M B2 {backpatch(B1.truelist, M.quad); B.truelist := B2.truelist; B.falselist:=merge(B1.falselist, B2.falselist);} B1的代码 B.truelist B1.truelist B2.truelist B2的代码 M.quad B1.falselist B2.falselist B.falselist and * * 6.6.1 布尔表达式的回填式翻译 B ? not B1 {B.truelist := B1.falselist; B.falselist := B1.truelist;} B ? (B1 ) {B.truelist := B1.truelist; B.falselist := B1.falselist;} * * 6.6.1 布尔表达式的回填式翻译 B ? E1 relop E2 { B.truelist:=makelist(nextquad); B.falselist:=makelist(nextquad+1); gencode(‘if’E1.addr relop E2.addr ‘goto-’); gencode(‘goto-’) } * * 6.6.1 布尔表达式的回填式翻译 B ? true {B.truelist := makelist(nextquad); gencode(‘goto-’)} B ? false {B.falselist := makelist(nextquad); gencode(‘goto-’)} * * 例6.11 B.t = {100, 104} B.f = {103,105} M.q:={102} B.t := {100} B.f := {101} B.t = {104} B.f = {103,105} B.t = {102} B.f = {103} B.t = {104} B.f = {105} 图6.27 ab or cd and ef的注释分析树 a b or ε M.q:={104} and ε c d e f 100: if ab goto – 101: goto - 102: if cd goto 104 103: goto – 104: if ef goto – 105: goto - 100: if ab goto – 101: goto - 102: if cd goto – 103: goto - 104: if ef goto – 105: goto - 100: if ab goto – 101: goto 102 102: if cd goto 104 103: goto – 104: if ef goto – 105: goto - M.q:={102} M.q:={104} B.t代表B.truelist B.f代表B.falselist M.q代表M.quad * * 6.6.2 常见控制结构的回填式翻译 S ? if B then M S1 | if B then M1 S1 N else M2 S2 | while M1 B do M2 S1 | S1;M S2 M ? ε {M.quad := nextquad} N ? ε {N.nextlist:=makelist(nextquad); gencode(‘goto -)} * * if-then语句的回填式翻译 S ? if B then M S1 {backpatch(B.truelist, M.quad) S.nextlist:=merge(B.falselist, S1.nextlist)} B的代码 S⑴的代码 if B.truelist B.falselist S.nextlist S⑴ .nextlist

文档评论(0)

花千骨 + 关注
实名认证
内容提供者

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

1亿VIP精品文档

相关文档