📄 4.7.2.0b.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.0.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.7.2.1.htm'"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>    </td>
<td class="content">
<p><font class="emphasize">LR(0)项目集规范族及识别活前缀的DFA
</font></p>
<p>
<img class="dingyi" src="../images/dingyi.gif">
<font class="definition2">定义4.7</font>我们说项目A→β<sub>1</sub>·β<sub>2</sub>对活前缀γ=αβ<sub>1</sub>是有效的,如果存在一个规范推导S<img src="images/equalstar.gif" width="20" height="19">αAw<img src="images/equal.gif">αβ<sub>1</sub>β<sub>2</sub>w。<br>
<p>若项目A→α·Bβ对活前缀γ=δα是有效的且若B→η是一个产生式,则项目B→·η 对γ=δα也是有效的。因为根据假定,存在一个规范推导 <br>
S<img src="images/equalstar.gif" width="20" height="19">δAw <img src="images/equal.gif"> δαBβw <br>
设规范推导βw<img src="images/equalstar.gif" width="20" height="19">xw,则对任何B→η 有规范推导 <br>
S <img src="images/equalstar.gif" width="20" height="19"> δAw <img src="images/equal.gif"> δαBβw <img src="images/equalstar.gif"> δαBxw <img src="images/equal.gif"> δαηxw <br>
于是B→·η对γ也是有效的。</p>
<p>
<img class="dingyi" src="../images/dingyi.gif"></img>
<font class="definition2">定义4.8</font>文法G的某个活前缀γ的所有有效项目组成的集合称为γ的有效项目集。文法G的所有有效项目集组成的集合称为G的LR(0)项目集规范族。</p>
<p>为了求出文法G的LR(0)项目集规范族,我们需要引进闭包运算(closure)和转移函数(go)的概念。</p>
<p>
<img class="dingyi" src="../images/dingyi.gif"></img>
<font class="definition2">定义4.9</font>设I是文法G的一个LR(0)项目集合,closure(I)是从I出发用下面三个规则构造的项目集: <br>
1.每一个I中的项目都属于closure(I)。 <br>
2.若项目A→α·Bβ属于closure(I)且B→η是G的一个产生式,若B→·η不属于closure(I),则将B→·η加进closure(I)。 <br>
3.重复执行规则(2)直到closure(I)不再增大为止。</p>
<p>显然对任何有效项目集I,都有I= closure(I)。 </p>
<p>以后我们称项目集中一切形如A→α·Bβ的项目(即圆点后紧跟非终结符号的项目)为基本项目。</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.0.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.7.2.1.htm'"></img></td>
</tr>
</table>
</BODY>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -