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

📄 5.5.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='5.5.2.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.5.2_1b.htm'"></img></td>
</tr>
</table>
<br><br>



<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p><b>例5.16 </b>图5.17中的文法是LL(1)文法,因此它适于自顶向下的分析。从文法中非终结符号的属性,我们可以得到函数E,R和T的自变量和结果的如下的类型。由于E和T没有继承属性,所以它们不含有自变量: 
</p>
</td>
</tr>
</table>



<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p><b>&nbsp;&nbsp; function</b> E:↑syntax-tree-node;<br> 
&nbsp;&nbsp;&nbsp; <b>&nbsp;&nbsp;&nbsp;functlon</b> R(in:↑syntax-tree-node)<br>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp:↑syntax-tree-node;<br> 
&nbsp;&nbsp;&nbsp; <b>&nbsp;&nbsp;&nbsp;function</b> T:↑syntax-tree-node;  
</p>
</td>
</tr>
</table>



<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>我们把图5.17的两个R产生式结合起来使翻译程序更小,新的产生式用符号<b>addop</b>代表+和-:  
</p>
</td>
</tr>
</table>



<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>&nbsp;&nbsp;&nbsp;&nbsp; R→<b>addop</b><br> 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T{R<span class="down"><sub>1</sub></span>.i:=mknode(addop.lexeme,R.i,T.nptr)}<br> 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R<span class="down"><sub>1</sub></span>{R.s:=R<span class="down"><sub>1</sub></span>.s}<br> 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R→ε{R.s:=R.i}<br> 
&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(5.5) 
</p>
</td>
</tr>
</table>


<br>
<br>
<table align=right width=300>
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.5.2.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.5.2_1b.htm'"></img></td>
</tr>
</table>

</BODY>

⌨️ 快捷键说明

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