📄 5.3.0b.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='5.3.0.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.3.1.htm'"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>    </td>
<td class="content">
<p>设当前的栈顶由指针top指示。我们假设综合属性是刚好在每次归约前计算的。假设语义规则A.a:=f(X.x,Y,y,Z.z)是对应于产生式A→XYZ的。在把XYZ归约成A以前,属性Z.z;的值放在val[top]中,Y.y的值放在val[top-1]中,X.x的值放在val[top-2]中。如果一个符号没有综合属性,那么数组val中相应的元素就不定义。归约以后,top值减2,A的状态存放在state[top]中(也就是X的位置),综合属性A.a的值存放在val[top]中。
</p>
</td>
</tr>
</table>
<table><tr><td>    </td>
<td class="content">
<p>
<B>例5.10</B>
我们再考虑一下表5.1中台式计算器的语法制导定义。在自底向上分析输入符号串3*5+4<B>n</B>时,图5.2中带注释分析树的综合属性可以由LR分析器计算出来。象前面一样,我们假设属性<B>digit</B>.lexical的值是由词法分析器产生的,它代表一数字的数值。当分析器把一个<B>digit</B>移人栈中的时候,输入的数字就放在state[top]中,它的属性值放在val[top]中。</p>
</td>
</tr>
</table>
<table>
<tr>
<td><font class="yanshi">     观看演示 </font></td>
<td><font color=blue onmouseover="javascript:style.cursor='hand'" onclick="javascript:open('compile5_3/compile5_3/compile.html','_blank','menu=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,left=100,top=100,width=800,height=600')">S-属性定义及其自底向上的计算</font></td>
<td><img src="../images/yanshi.gif"></img></td>
</tr>
</table>
<br>
<table align=right width=300>
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.3.0.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.3.1.htm'"></img></td>
</tr>
</table>
</BODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -