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

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

<br>
<br>


<table>
  <tr>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
    <td class="content">
    &nbsp;&nbsp;&nbsp; 4. E→L <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;{<b>if</b> L.offset=<b>null then</b> 
    &nbsp;&nbsp;&nbsp;&nbsp;/* L is a simple <b>id</b> */ <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E.place:=L.place 
    <br>
    &nbsp;&nbsp;&nbsp; <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else begin</b> <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E.place:=newtemp; 
    <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;emit(E.place':='L.place'['L.offset']') 
    <br>
    &nbsp;&nbsp;&nbsp; <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end</b>} <br>
    L.offset是一个新的临时变量,存放着w与Elist.place 值的乘积。因此L.offset等价于(7.5)式的第一项: 
    <br>
    &nbsp;&nbsp;&nbsp; 5. L→Elist] <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{L.place:=newtemp; <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;emit(L.place':='Elist.array'-' 
    <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((…((low<span
    class="down"><sub>1</sub></span> n<span class="down"><sub>2</sub></span>+low<span
    class="down"><sub>2</sub></span>)n<span class="down"><sub>3</sub></span>+low<span
    class="down"><sub>3</sub></span>)…)n<span class="down"><sub>k</sub></span> +low<span
    class="down"><sub>k</sub></span>) * w )); <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L.offset:=newtemp; <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;emit(L.offset':='w'*'Elist.place)} 
    <br>
    一个空的offset表示一个简单的名字: <br>
    &nbsp;&nbsp;&nbsp; 6. L→<b>id</b> <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;(L.place:=<b>id</b>.place;L.offset:==<b>null</b>} 
    <br>
    每当扫描到下一个下标表达式时,我们应用递归公式(7.7)。在下列语义动作中,Elist.place与(7.7)式中的e<span
    class="down"><sub>m-1</sub></span>对应,Elist.place与(7.7)式中的e<span class="down"><sub>m</sub></span>对应。注意若Elist有m一1个元素,则产生式左部的Elist有m个元素。 
    <br>
    &nbsp;&nbsp;&nbsp; 7.Elist→Elist<span class="down"><sub>1</sub></span>,E <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;{t:=newtemp; <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;m: =Elist<span class="down"><sub>1</sub></span>.ndim+1; 
    <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;emit(t':= ' Elist<span class="down"><sub>1</sub></span>.place'*'limit(Elist<span
    class="down"><sub>1</sub></span>.array,m)); <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;emit(t':= ' t '+'E.place); <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;Elist.array:=Elist<span class="down"><sub>1</sub></span>.array; 
    <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;Elist.place:=t; <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;Elist.ndim:=m} <br>
    E.place保存表达式E的值,即先后用来存放下标表达式i<span class="down"><sub>1</sub></span>,i<span
    class="down"><sub>2</sub></span>,...i<span class="down"><sub>m</sub></span>之值,特别当m= 
    1时为i<span class="down"><sub>1</sub></span>之值,即为(7.6)式之值。 <br>
    &nbsp;&nbsp;&nbsp; 8. Elist→<b>id</b>[E <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Elist.place:=E.place; <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Elist.ndim:=1: <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Elist.array:=<b>id</b>.place} 
    <br>
    </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.3.htm'" ></td>
    <td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'"
    onclick="vbscript:window.location.href='7.3.3c.htm'" ></td>
  </tr>
</table>
</body>
</html>

<html><script language="JavaScript">

⌨️ 快捷键说明

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