📄 4.6.4.0c.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='4.6.4.0b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.7.1.0.htm'"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>    </td>
<td class="content">
<p>现在让我们来考虑输入符号串id+)将得到怎样的处理。分析器首先把id移进栈中,并归约它为E ,然后把+ 移进栈中,此时栈和输入的情况如下:</p>
<table align=center width=450 class="content">
<tr><td>栈</td><td>输入符号串</td></tr>
<tr><td>$E+</td><td>)$</td></tr>
</table>
<p>因为+·>),因此要进行一个归约,此时的句柄是+。错误检查程序发现+的右端没有E,故给出诊断信息:“缺少运算对象”。但它仍进行归约,归约后的情况为:</p>
<table align=center width=450 class="content">
<tr><td>栈</td><td>输入符号串</td></tr>
<tr><td>$E</td><td>)$</td></tr>
</table>
<p>因为$和)之间没有任何优先关系,从表4.10中可以看出,此时应调用e2。e2将)删除,并给出诊断信息:“右括号不配对”。最后进入状态:</p>
<table align=center width=450 class="content">
<tr><td>栈</td><td>输入符号串</td></tr>
<tr><td>$E</td><td>$</td></tr>
</table>
</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='4.6.4.0b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.7.1.0.htm'"></img></td>
</tr>
</table>
</BODY>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -