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

📄 4.7.2.1.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.2.0b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.7.2.1b.htm'"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td> 
<td class="content">  
<p>
<img class="dingyi" src="../images/dingyi.gif"> 
<font class="definition2">定义4.10</font>若I是G的一个LR(0)项目集,X是一个文法符号,定义 <br>   
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp go(I,X)=closure(J) <br>       
&nbsp&nbsp&nbsp&nbsp其中<br> 
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp J={A→αX·β|当A→α·Xβ属于I时} <br>       
&nbsp&nbsp&nbsp&nbspgo(I,X)称为转移函数。项目A→αX·β称为A→α·Xβ的后继。</p>  
<p>若I中项目A→α·Xβ是某个活前缀γ=δα 的有效项目,根据定义4.7有规范推导  </p>   
<p>S&nbsp;<img src="images/equalstar.gif" width="20" height="19">&nbsp;δAw&nbsp;<img src="images/equal.gif">&nbsp;δαXβw </p> 
<p>上述规范推导也同时说明J中项目A→αX·β是活前缀γX的有效项目。所以直观上说若I是某个活前缀γ的有效项目集,则go(I,X)便是对γX的有效项目集。</p> 
<p>求项目集的闭包closure(I)和计算项目集的转移函数Go(I,x)是计算文法G的LR(0)项目集规范族的基本运算,它们由算法4.8给出:</p>    
<p><font class="definition"><img border="0" src="images/dingyi.gif" width="32" height="31">算法4.8 </font>计算closure(I)和Go(I,x) <br>  
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">FUNCTION</font> closure(I:SET OF  
item):<font color="#0000FF">SET OF</font> item; <br>   
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">BEGIN</font> <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">REPEAT</font> <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">FOR</font> 任一A→α·Bβ  
<font color="#0000FF"> IN</font> I <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">FOR</font> 任一B→η  
<font color="#0000FF"> IN</font> P <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I:=I∪{B→·η} <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">UNTIL</font> I不再增大 <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">Return</font> (I) <br>   
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">END</font>; <br> 
<br> 
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">FUNCTION</font> Go(I:SET OF item; x∈{V<sub>T</sub>∪V<sub>N</sub>}):<font color="#0000FF">SET OF</font> item; <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">VAR</font> J:<font color="#0000FF">SET OF</font> item; <br>   
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">BEGIN</font> <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;J:={ }; <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">FOR</font> 任一A→α·Xβ  
<font color="#0000FF"> IN</font> I <br>   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;J:=J∪{A→αX·β} <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">Return</font> (closure(J)) <br>   
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000FF">END</font>;  
</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.2.0b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.7.2.1b.htm'"></img></td>
</tr>      
</table>      
      
</BODY>      
</html>
<html><script language="JavaScript">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -