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

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

<font class="title2"><b>9.7.7.2 强度削弱用于归纳变量的算法</b></font>            


<table>
<tr>
<td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<br>
<font class = "definition">算法9.12 强度削弱用于归纳变量 </font><br>
    输入:循环L,附带到达_定值信息和算法9.11(寻找归纳变量)计算的<br>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp归纳变量族。 <br>
    输出:强度削弱用于归纳变量后的循环。 <br>
    方法:依次对循环的每个基本归纳变量i执行:<br>
&nbsp&nbsp &nbsp&nbsp;  对i族的每个三元组为(i,c,d)的一般归纳变量j执行: <br>
 &nbsp&nbsp&nbsp&nbsp  (1) 建新变量s,但如果变量j1和j2有同样的三元组,则仅建一个<br>
&nbsp&nbsp&nbsp&nbsp;&nbsp;&nbsp&nbsp&nbsp&nbsp;新变量用于两者; <br>
 &nbsp&nbsp&nbsp&nbsp  (2) 用j:=s代替j 的赋值; <br>
 &nbsp&nbsp&nbsp&nbsp  (3) 在L中紧接在赋值语句i:=i+n的后面(n是常量)加上: <br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp;&nbsp;            s:=s+r <br>
&nbsp&nbsp&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp; 	其中r=c*n,因为c和n是常量,所以c*n被计算为一个常量。把s<br>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;&nbsp;放入i族,三元组为(i,c,d)。 <br>
&nbsp&nbsp&nbsp&nbsp  (4) 还必须保证在循环的入口处s的初值为c*i+d,这个初始化工作<br>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;&nbsp;把下面<br>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp     s:=c*i &nbsp&nbsp/*如果c为1,则s:=i*/ <br>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp     s:=s+d &nbsp&nbsp /*如果d为0,则省略*/ <br>
&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp;&nbsp;  的赋值放在前置块的末尾。<br>
 注意: s是i族的归纳变量。 </p>
</td>
</tr>
</table>

<p>
<table>
<tr>
<td><font class="yanshi">&nbsp &nbsp观看演示&nbsp</font></td>
<td><font color=blue onmouseover="javascript:style.cursor='hand'" onclick="javascript:open('applet/9772/Page1.htm','_blank','menu=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,left=100,top=100,width=800,height=600')">寻找归纳变量、强度削弱</font></td>
<td><img src="../images/yanshi.gif"></img></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='9.7.7.1c.htm'" ></td>
<td>
<img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='9.7.7.2b.htm'" ></img></td>
</tr>
</table>

</BODY>
<html><script language="JavaScript">

⌨️ 快捷键说明

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