📄 7.7.0c.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.7.0b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='7.8.0.htm'"></img></td>
</tr>
</table>
<br><br>
<table><tr><td>    </td>
<td class="content">
<p>一般而言,为了在处理实在参数串的过程中记住每个实参的地址,以便最后把它们排列在call指令之前,我们需要把这些地址存放起来。用来存放这些地址的一个方便的数据结构是队列,一个先进先出表。我们将赋予产生式Elist→Elist,E的语义动作是:将表达式E的存放地址E.place放入队列queue中。产生式S→call
id (Elist)的语义动作是:对队列queue中的每一项生成一条param语句,并让这些语句接在对参数表达式求值的那些语句之后。对参数表达式求值的语句已在将它们归约为E时产生。下面的语法制导翻译体现了上述思想。
<p>1.S→call id (Elist)
<p>   { for each item p on queue do
<p>     emit('param' p);
<p>     emit('call' id.place)}
<p>S的代码包括:首先是Elist的代码(即对各参数表达式求值的代码),其次是顺序为每一个参数对应一条param语句,最后是一个call语句。
<p>2. Elist→Elist,E
<p>   { 将E.place加入到queue的队尾}
<p>3. Elist→E
<p>  { 初始化queue仅包含E.place}
<p>  这里,初始化queue为一个空队列,之后将E.place送入queue。
</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='7.7.0b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='7.8.0.htm'"></img></td>
</tr>
</table>
</BODY>
</html>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -