📄 7.6.2.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.6.1_2b.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='7.6.2b.htm'"></img></td>
</tr>
</table>
<br><br>
<font class="title2"><b>7.6.2 使用回填翻译控制流语句</b></font>
<table><tr><td>    </td>
<td class="content">
<P>现在,我们来看如何使用回填一遍翻译控制流语句。设有文法:
<br> (1)S→if E then S
<br> (2) |if E then S else S
<br> (3) | while E do S
<br> (4) |begin L end
<br> (5) |A
<br> (6)L→L;S
<br> (7) |S<br>
作为一个大例子,我们考虑此文法所生成的语句的一个翻译模式。这里,S表示语句,L表示语句表,A为赋值语句,E为一个布尔表达式。实际上还应有一些其它的产生式如生成赋值语句的产生式,然而这里所给出的已足够用来说明翻译控制流语句的技术。
<p>我们将来用与7.4节相同的关于if-then,if-then-else,和while- do语句的代码结构。
<p>上述文法给出的控制流语句的翻译模式如下:
<center><IMG src="7_6_2.gif" width="517" height="419">
</center>
</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.6.1_2b.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='7.6.2b.htm'"></img></td>
</tr>
</table>
</BODY>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -