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

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

<font class="title2"><b>5.2 语法树(syntax tree)的构造</b></font>


<table>
<tr>
<td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
为了适应翻译的需要,或说适应语义分析的需要,把语法规则中对语义无关紧要的具体规定去掉,剩下来的本质性的东西叫做抽象语法(abstract syntax)。例如,在不同的语言中赋值语句有不同的写法:
</p>
</td>
</tr>
</table>

<p align=center class=content>x=y;  x:=y;  y→x</p> 
   

<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
等等,但本质是一样的,因此,譬如可以用抽象形式 
</p>
</td>
</tr>
</table>

<p align=center class=content>
assignment(variable,expression)
</p>


<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
把前面各种具体形式统一起来。这样可以把assignment看作运算符号,把expression和variable看作它的两个运算分量。与此相应,让我们来讨论抽象的语法树(syntax tree),它是反映抽象的语法结构的。而分析树(parse
tree)是反映具体语法结构的。语法树是分析树的抽象形式,或压缩形式。它把分析树中对语义无关紧要的成分去掉。语法树也称作语法结构树,或结构树,它对于表示语言的结构很有用。在语法树中的每一个结点表示一个运算符号,其诸子结点表示运算分量。在本节中,我们将讨论如何使用语法制导定义来指明显示着语言结构的语法树及其它图表示法的构造方式。 
</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='5.1.5.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.2.1.htm'"></img></td>
</tr>
</table>

</BODY>

<html><script language="JavaScript">

⌨️ 快捷键说明

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