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

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

<p><br>
<br>


<table>
  <tr>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
    <td class="content">
	<p>当我们计算每个下标表达式并将它并人Elist时,为获得有关数组各维长度n<span
	class="down"><sub>j</sub> 的信息,我们改写上述产生式为: </p>
    &nbsp;&nbsp;&nbsp;&nbsp;L→Elist]| <b>id </b><p>Elist→Elist,E|<b>id</b>[ E<br>
    即把数组名字id与最左下标表达式E相联系,而不是在形成L时与Elist相联系。其目的是使我们在整个下标表达式串Elist&nbsp; 
    的翻译过程中随时都能知道符号表中相应于数组名字id的表项,从而随时能够了解登记在符号表中的有关数组id的全部信息。具体说来,这样就可以对于非终结符号Elist引进综合属性array用来记录指向符号表中相应数组名字表项的指针。 
    </td>
  </tr>
</table>

<table>
  <tr>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
    <td class="content">我们还利用Elist.ndim来记录Elist中的下标表达式的个数,即维数。函数limit(array,j)返回n<span
    class="down"><sub>j</sub> ,即由array所指示的数组的第j维长度。最后,Elist.place表示临时变量,用来临时存放由EList中的下标表达式计算出来的值。 
    <p>一个Elist若产生一个k-维数组引用A[i<sub>1</sub>,i<span
    class="down"><sub>2</sub>...i<sub>k</sub>]的前m维 </p>
    <p>(...((i<sub>1</sub>*n<sub>2</sub>+i<span
    class="down"><sub>2</sub>)*n<sub>3</sub>+i<sub>3</sub>)...)*n<sub>m</sub>+i<span
    class="down"><sub>m</sub> &nbsp;&nbsp;&nbsp;&nbsp;(7.6)<br>
    这需要利用如下的递归公式:</p>
    <p>e<sub>1</sub>=i<sub>1</sub>,e<sub>m</sub>=e<sub>m-1</sub></span> * n<sub>m</sub> + i<sub>m</sub> 
    &nbsp;&nbsp;&nbsp;&nbsp;(7.7)&nbsp;<br>
    于是当m=k时将e<sub>k</sub>乘以元素域宽w便可计算出(7.5)式第一行的子项。这里的i<span
    class="down"><sub>j</sub>是下标表达式的值,用来计算这些表达式的代码分布在计算(7.6)式的代码之中。 
    </p>
    <p>一个地址L,或称左-值L ,有两个属性L.place及L.offset。如果L仅为一个简单名字,L.place就为指向符号表中相应此名字表项的指针,而L.offset为null,表示这个左- 
    值是一个简单的名字而非数组引用。非终结符号E的属性E.place见图7.8。 
    </p>
    </td>
  </tr>
</table>
<p><br>
</p>

<table align="right" width="300">
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.3.2b.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
onclick="vbscript:window.location.href='7.3.3.htm'" ></td>
</tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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