⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 4.8.1b.htm

📁 建立《编译原理网络课程》的目的不仅使学生掌握构造编译程序的原理和技术
💻 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.1.htm'" width="24" height="24"></img></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.8.1c.htm'" width="26" height="24"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>&nbsp&nbsp</td>     
<td class="content">   
<p>
假定输入符号串为id+id+id。在处理了id+id之后,分析器仍到达状态I<sub>7</sub>,这时的栈内容同样是0E1+4E7,而输入符号串的剩余部分为+id$。当状态I<sub>7</sub>面临输入符号+时,同样存在“移进-归约”冲突。这时算符+的结合律告诉我们应该如何解决这一冲突。如果+服从右结合,那就应该移进。通常习惯采用左结合规则。 </p>      
<p>总之,若令+服从左结合规则,则当I<sub>7</sub>面临输入符号+时应采用E→E+E进行归约。若令*优先于+,则I<sub>7</sub>面临输入符号*时应执行移进。同理若令*服从左结合,*优先于+,则状态I<sub>8</sub>面临输入符号+或*时都应采用E→E*E进行归约。用这种办法得到的文法(4.19)的LR分析表如表4.17所示。</p>   
    
<p><font class="example">例4.22 </font>我们考虑if…then…else结构的文法。  
<table align=center width=450 class="content">  
<tr><td>(1)S→iSeS </td><td></td></tr>     
<tr><td>(2)S→iS</td><td>(4.21)</td></tr>     
<tr><td>(3)S→a</td><td></td></tr>     
</table>  
</td></tr></table>    
<p>      
<center><img src="images/4.27.gif"></center><br>  
<center class="content">图4.27 拓广文法(4.21)的LR(0)项目集规范族</center></p>    
<table align=right width=300>       
<tr>       
<td>
<img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.8.1.htm'" width="24" height="24"></img></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.8.1c.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 + -