📄 4.8.1c.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.8.1b.htm'" width="24" height="24"></img></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.9.1.0.htm'" width="26" height="24"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>  </td>
<td class="content">
<p>文法(4.21)的LR(0)项目集规范族如图4.27所示。我们转而使用if…then…else的术语。当if C then S呈现在栈顶并面临输入符号else时,我们应该执行移进还是归约呢?按通常习惯,是让else与最近一个then相结合,因此应该执行移进。用文法(4.21)的术语,呈现于栈顶的文法符号串是iS,现在所面临的e只是以iS为首的这个候选式的一部分,如果跟在e后面的符号不能归约出一个S,那么整个输入符号串就无法最后归约到S。我们的结论是:状态I<sub>4</sub>存在的“移进-归约”冲突应采取移进e的办法来解决。借助这一想法我们就可以从文法(4.21)的LR(0)项目集规范族构造出它的LR分析表如表4.18所示。 </p>
</td></tr></table>
<center><img src="images/table4.18.gif" ></center><br>
<table><tr><td>  </td>
<td class="content">
<p>假定输入符号串为iiaea。整个分析过程如表4.19所示。表中第5行,状态I<sub>4</sub>面临输入符号e时选择了移进动作。表中第9行,状态I<sub>4</sub>面临$时选择了用S→iS进行归约。</p>
</td></tr></table>
<center><img src="images/table4.19.gif" width="366" height="302" ></center><br>
<table align=right width=300>
<tr>
<td>
<img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.8.1b.htm'" width="24" height="24"></img></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.9.1.0.htm'" width="26" height="24"></img></td>
</tr>
</table>
</BODY>
</html>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -