⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 7.6.1_2.htm

📁 建立《编译原理网络课程》的目的不仅使学生掌握构造编译程序的原理和技术
💻 HTM
字号:
<html>

<head>
<title>编译原理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link type="text/css" rel="stylesheet" href="../css/specification.css">
</head>

<body>

<table align="right" width="300">
  <tr>
    <td>
    <img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'"
    onclick="vbscript:window.location.href='7.6.1c.htm'" width="24" height="24" ></td>
    <td>
    <img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
    onclick="vbscript:window.location.href='7.6.1_2b.htm'" width="26" height="24" ></td>
  </tr>
</table>

<p><br>
<br>
</p>

<table>
  <tr>
    <td class="content"><font class="example">例7.5</font> 重新考虑表达式a<b or c<d 
    and e<f。一棵作了注释的分析树如图7.15所示。语义动作是在对树的深度优先遍历中完成的。由于所有的语义动作均出现在产生式的右端的终点,因而它们可以在自下而上的语法分析中随着对产生式的归约来完成。
    <center><img src="images/7_15.gif" width="567" height="281"> </center>
    <p align="center">图7.15 关于a&lt;b or c&lt;d and e&lt;f 的加了注释的分析树</p>
    <p>在利用产生式(5)将a<b归约为E时,生成如下两个四元式: <br>
    &nbsp;&nbsp;&nbsp; 100 : if a<b goto-- <br>
    &nbsp;&nbsp;&nbsp; 101 : goto--<br>
    这里我们假定语句标号从100开始。如图7.15所示,相应的E结点处的E.truelist所指示的表记录着标号100,E.falselist所指示的表记录着标号101。简写作E.t= 
    {100),E. f= {101)。之后,在产生式E→E<span class="down"><sub>1</sub></span> 
    or M E<span class="down"><sub>2</sub></span>中的M的语义动作(8)被执行,得到M. 
    quad之值为102。再用产生式(5)将c<d归约到E时,生成如下两个四元式: 
    <br>
    &nbsp;&nbsp;&nbsp; 102 :if c<d goto-- <br>
    &nbsp;&nbsp;&nbsp; 103 : goto--<br>
    相应的E结点处的E. t={102},E. f= {103}。现在我们已分析完了产生式E→E<span
    class="down"><sub>1</sub></span> and M E<span class="down"><sub>2</sub></span>中的E<span
    class="down"><sub>1</sub></span>。在此产生式中的M.quad=104。当用产生式(5)将e<f归约到E时,产生如下两个四元式: 
    <br>
    &nbsp;&nbsp;&nbsp; 104 : if e<f goto-- <br>
    &nbsp;&nbsp;&nbsp; 105 : goto--<br>
    </td>
  </tr>
</table>
<p><br>
</p>

<table align="right" width="300">
  <tr>
    <td>
    <img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'"
    onclick="vbscript:window.location.href='7.6.1c.htm'" width="24" height="24" ></td>
    <td>
    <img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
    onclick="vbscript:window.location.href='7.6.1_2b.htm'" width="26" height="24" ></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -