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

📄 5.2.3b.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.2.3.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.2.4.htm'"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
与产生式T→<b>id</b>和T→<b>num</b>相对应的语义规则决定了属性T.nptr分别表示指向一个标识符和一个数的新的叶结点的指针。属性<b>id</b>.entry和<b>num</b>.val是词法值,我们假设这些值是由词法分析器提供的。
</p>
</td>
</tr>
</table>

<p align=center><img src="images/5_7.gif" ></p>
<p align=center>图5.7 a-4+c的语法树的构造</p>


<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>在图5.7中,当一个表达式是一个单个项时,相应于使用产生式E→T,属性E.nptr得到T.nptr的值。当与产生式E→E<sub>1</sub>-T对应的语义规则被引用时,前面的规则已经把E<sub>1</sub>.nptr和T.nptr分别置成指向代表a和4的叶结点的指针。
</p>
</td>
</tr>
</table>



<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
为了清楚地解释图5.7,我们应注意,图中下面的由记录组成的树是构成输出的一个“真正的”语法树,而上面的虚线树是一个分析树,它只是象征性地存在。在下面一节中,我们将讨论怎样使用自底向上分析器的栈跟踪属性值的方法来简单地实现一个S-属性定义。实际上,在这样的实现过程中,建立结点的函数调用顺序与在例5.7中的顺序相同。 
</p>
</td>
</tr>
</table>


<table>
<tr>
<td><font class="yanshi">&nbsp&nbsp&nbsp&nbsp&nbsp;&nbsp;&nbsp; 观看演示&nbsp</font></td>
<td><font color=blue onmouseover="javascript:style.cursor='hand'" onclick="javascript:open('compile5_2/compile.html','_blank','menu=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,left=100,top=100,width=800,height=600')">语法树的构造</font></td> 
<td><img src="../images/yanshi.gif"></img></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='5.2.3.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.2.4.htm'"></img></td>
</tr>
</table>

</BODY>

<html><script language="JavaScript">

⌨️ 快捷键说明

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