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

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

<font class="title2"><b>练习</b></font>
<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">

<a name="5.6"></a>

5.6 重写例5.3中语法制导定义的基础文法,使类型信息只需用综合属性来传递。                                          
<table align=center width=70%>
<tr><td align=right>
<img src="../images/key.gif" onmouseover="javascript:style.cursor='hand'" onclick="javascript:window.open('key/a_5.6.htm','','left=50,top=40,toolbar=no,scrollbars=yes,width=600,height=500')"></img>
</td></tr>
</table>

<a name="5.7"></a>

<hr size=2 align=center color=red><br>               

5.7 试从练习5.4(a) 和(b)中的语法制导定义中消除左递归。                                          
<table align=center width=70%>
<tr><td align=right>
<img src="../images/key.gif" onmouseover="javascript:style.cursor='hand'" onclick="javascript:window.open('key/a_5.7.htm','','left=50,top=40,toolbar=no,scrollbars=yes,width=600,height=600')"></img>
</td></tr>
</table>

<a name=5.8></a>
<hr size=2 align=center color=red><br>               

5.8 给出一个检查同一个标识符不在标识符表中出现两次的翻译模式。                                          
<table align=center width=400>
<tr><td></td></tr>             
</table>
<table align=center width=70%>
<tr><td align=right>
<img src="../images/key.gif" onmouseover="javascript:style.cursor='hand'" onclick="javascript:window.open('key/a_5.8.htm','','left=50,top=40,toolbar=no,scrollbars=yes,width=600,height=550')"></img>
</td></tr>
</table>

<a name=5.9></a>
<hr size=2 align=center color=red><br>
5.9 假设说明是由下列文法产生的: <br>                                          
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;D→id L <br>                                          
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L→,id L|:T <br>                                          
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T→<b>ingeger</b> |<b>real</b>                                           
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;(a)建立一个翻译模式,把每一个标识符的类型加入到符号表中,正如在例5.3中的一样。 <br>
        &nbsp;&nbsp;&nbsp;&nbsp;(b)从(a)中的翻译模式构造一个预翻译程序。
<table align=center width=70%>
<tr><td align=right>
<img src="../images/key.gif" onmouseover="javascript:style.cursor='hand'" onclick="javascript:window.open('key/a_5.9.htm','','left=50,top=40,toolbar=no,scrollbars=yes,width=600,height=600')"></img>
</td></tr>
</table>

<a name="5.10"></a>

<hr size=2 align=center color=red><br>

5.10 下面的文法是表5.7中基础文法的无二义性形式,其中的花括号{ }只用于把盒子分组,并将在翻译过程中被消除。                                           
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S→L <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L→LB|B <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B→B sub F|F <br>                                          
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F→{L}|<b>text</b> <br>
        &nbsp;&nbsp;&nbsp;&nbsp;(a)用上面的文法修改表5.7中的语法制导定义。 <br>
        &nbsp;&nbsp;&nbsp;&nbsp;(b)把(a)中的语法制导定义转化成翻译模式。
<table align=center width=70%>
<tr><td align=right>
<img src="../images/key.gif" onmouseover="javascript:style.cursor='hand'" onclick="javascript:window.open('key/a_5.10.htm','','left=50,top=40,toolbar=no,scrollbars=yes,width=600,height=600')"></img>
</td></tr>
</table>
<hr size=2 align=center color=red><br>
<br>
<table align=right width=300>
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.9.0.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.9.0c.htm'"></img></td>
</tr>
</table>

</BODY>

⌨️ 快捷键说明

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