📄 7.1.5.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.4.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.1.5b.htm'" ></td>
</tr>
</table>
<p><br>
<br>
<font class="title2"><b>7.1.5 三地址代码的具体实现</b></font> </p>
<table>
<tr>
<td> </td>
<td class="content">
<p>三地址语句可看成中间代码的一种抽象形式。具体实现方法可以用四元式、三元式和间接三元式。有些书中称三元式为“两地址代码",四元式为“三地址代码”。在本书中,我们将“三地址代码”看作为各种不同实现方式的一种抽象形式。其中四元式为主要的一种实现方式。</P>
</td>
</tr>
</table>
<table>
<tr>
<td> </td>
<td class="content"><font class="emphasize">1.四元式 </font></td>
</tr>
</table>
<table>
<tr>
<td> </td>
<td class="content">
<p>一个四元式是一个带有四个域的记录结构,这四个域分别称为op,arg1,arg2,及result。域op包含一个代表算符的内部编码。三地址语句x:=y
op z可表示为:将y置于arg1域,z 置于arg2域,x置于result域,:=
为算符。带有一目算符的语句如x:=-y或者x:= y 的表示中不用arg2。而象param这样的算符仅使用arg1域。条件和无条件转移语句将目标标号置于result域中。赋值语句a:= b * -c + b * -c的四元式表示如表7.3(a)所示,它对应图7.3(a)中的三地址代码。 </p>
</td>
</tr>
</table>
<p align="center"><img src="t7_3.gif" width="584" height="439" alt="t7_3.gif (6438 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.4.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.1.5b.htm'" ></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -