📄 7.1.5b.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='7.1.5.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.1.5c.htm'" ></td>
</tr>
</table>
<p><br>
<br>
<table>
<tr>
<td> </td>
<td class="content"><font class="emphasize">2.三元式 </font></td>
</tr>
</table>
<table>
<tr>
<td> </td>
<td class="content">
<p>一个三元式是一个带有三个域的记录结构,这三个域分别称为op,arg1和arg2,即算符op,第一运算分量arg1和第二运算分量arg2,如表7.3(b)所示。(b)中的三元式是与(a)中的四元式相对应的。四元式中的arg1,arg2和result的内容都是一个指针,此指针指向有关名字的符号表表项。而三元式中的arg1和arg2既可以是指向有关名字的符号表表项的指针,也可以是指向三元式表自身的某一项的指针。例如在表7.3(b)中的三元式(0)的计算结果为-c;三元式(1)表示b与三元式(0)的结果相乘,即得到b*-c同样三元式(3)表示b与三元式(2)的结果相乘,也得到b*-c;三元式(4)表示三元式(1)的结果与三元式(3)的结果相加;最后三元式(5)表示要将三元式(4)的结果赋给a。除了在处理程序员定义的名字之外,三元式表与用结点的数组表示语法树或dag的方法相对应,见图7.2。在三元式表中,带括号的编号表示三元式结构本身的指针,而符号表的指针是由名字本身来表示的。 </p>
</td>
</tr>
</table>
<p align="center">
表7.3(c) 三地址语句的间接三元式表示<br><br>
<img src="t7_3c1.gif" width="284" height="141"
alt="t7_3c1.gif (2261 bytes)"> <img src="t7_3c2.gif" width="387" height="141"
alt="t7_3c2.gif (2922 bytes)"></p>
<table align="right" width="300">
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.1.5.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.1.5c.htm'" ></td>
</tr>
</table>
</body>
</html>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -