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

📄 4.7.4.4.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.7.4.3.htm'" width="24" height="24" ></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.7.4.4b.htm'" width="26" height="24"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td> 
<td class="content">  

<p>
<font class="example">例4.21 </font>考虑例4.20中的文法。让我们构造它的LALR(1)项目集的核。该文法的LR(0)项目集的核见图4.24。当我们应用算法4.14到项目集I<sub>0</sub>的核时,计算closure({[S'→·S,#] }),它将是:<br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S'→·S,# <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S→·L=R,# <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S→·R, # <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L→·*R,#/= <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L→·id,#/= <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R→·L,#    
</p>    
<p>在此闭包中有两项可导得自生搜索符。项目[L→·*R,=]使得“=”是I<sub>4</sub>中的核项目L→*·R的自生搜索符,以及项目[L→·id,=]使得“=”是在I<sub>5</sub>中的核项目L→id·的自生搜索符。算法4.15的(2)中所确定的核项目之中的搜索符的传播方式见表4.15。例如,I<sub>0</sub>在符号S,L,R,*和id之上的转移分别是I<sub>1</sub>,I<sub>2</sub>,I<sub>3</sub>,I<sub>4</sub>和I<sub>5</sub>(见图4.21)。对于I<sub>0</sub>我们仅得到含有一个核项目[S'→·S,$] 的闭包。于是,S'→·S传播它的这个搜索符给在I<sub>1</sub>至I<sub>5</sub>中的每一个核项目。   
</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.7.4.3.htm'" width="24" height="24" ></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.7.4.4b.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 + -