📄 4.5.2.1.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.5.2.0b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.5.2.1b.htm'"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>    </td>
<td class="content">
<p>又如,让我们再次考虑二义性文法:</p>
<p>(1)E→E+E</p>
<p>(2)E→E*E</p>
<p>(3)E→(E)</p>
<p>(4)E→<b>id</b></p>
<p>输入符号串<b>id<sub>1</sub></b>+<b>id<sub>2</sub></b>*<b>id<sub>3</sub></b>的分析(规范归约)步骤如表4.7(b)所示。这是按照4. 5.1节中对于该符号串的第一种推导给出的。</p>
<p>“移进-归约”分析对符号栈的使用有四类操作:移进、归约、接受和出错处理。</p>
<p>1. 在一个移进动作中,把下一个输入符号移进到栈的顶上。</p>
<p>2. 在一个归约动作中,当发现栈顶呈现可归约串时,用适当的相应符号去替换这个串。</p>
<p>3.在一个接受动作中,宣布最终分析成功。</p>
<p>4.在一个出错处理动作中,当发现语法错误时,调用一个出错处理程序进行诊察和校正。</p>
</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.5.2.0b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.5.2.1b.htm'"></img></td>
</tr>
</table>
</BODY>
</html>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -