📄 7.6.1_2b.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.1_2.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.6.2.htm'" ></td>
</tr>
</table>
<p><br>
<br>
</p>
<table>
<tr>
<td class="content">
相应的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>
104 : if e<f goto-- <br>
105 : goto--<br>
相应的E结点处的E.t={104},E. f= {105}。现在让我们对产生式E→E<span
class="down"><sub>1</sub></span> and M E<span class="down"><sub>2</sub></span>进行归约。相应的语义动作中有过程调用back-patch({102},104),其中参数{102}表示一个指针,此指针指向仅包含标号102的表,这个表就是那个由E<span
class="down">1</span>.truelist指向的。此E<span class="down">1</span>是由c<d所归约到的结点。此次调用将把104回填到指令102中的目标标号部分。另外,如图7.15所示,相应的E结点处的E.t={104},E.
f={103,105}。至今生成的六条指令如下: <br>
100 : if a<b goto- <br>
101 : goto- <br>
102 : if c<d goto 104 <br>
103 : goto- <br>
104 : if e<f goto- <br>
105 : goto一 <br>
最后用产生式E→E<span class="down"><sub>1</sub></span> or M E<span
class="down"><sub>2</sub></span>,进行归约,过程调用backpatch( { 101},102)将上述指令变为
<br>
100 : if a<b goto- <br>
10l : goto l02 <br>
102 : if c<d goto 104 <br>
103 : goto- <br>
104 : if e<f goto-- <br>
105 : goto--<br>
此外,在归约到的E 结点处有E.t={100,104},而E.f= {103,105}
。即如果我们分别用L<span class="down"><sub>1</sub></span>和L<span class="down"><sub>2</sub></span>来表示整个表达E的真、假两个出口的话,我们将有:
<br>
100 : if a<b goto L<span class="down"><sub>1</sub></span> <br>
101 : goto l02 <br>
102 : if c<d goio l04 <br>
103 : goto L<span class="down"><sub>2</sub></span> <br>
104 : if e<f goto L<span class="down"><sub>1</sub></span> <br>
105 : goto L<span class="down"><sub>2</sub><br>
</span>有关这些目标标号的填写将在下面的编译中讲到。即当知道了条件为真时和条件为假时分别应做哪些事时就可以进行回填了。
</td>
</tr>
</table>
<table>
<tr>
<td><font class="yanshi"> 观看演示 </font></td>
<td><font color="blue" onmouseover="javascript:style.cursor='hand'"
onclick="javascript:open('applets/test7_7/Page1.htm','_blank','menu=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,left=100,top=100,width=900,height=650')">使用回填翻译布尔表达式</font></td>
<td><img src="../images/yanshi.gif" width="36" height="35"></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.1_2.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.6.2.htm'" ></td>
</tr>
</table>
</body>
</html>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -