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

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

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

*5.11 扩充5.5节中消除左递归的转换,使翻译模式(5.2)中的非终结符号A允许: <br>                                          
        &nbsp;&nbsp;&nbsp;&nbsp;(a)由复写规则决定的继承属性。 <br>
        &nbsp;&nbsp;&nbsp;&nbsp;(b)继承属性。
<table align=center width=400>
</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.11.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>


5.12 试从练习5.10中的(b)的翻译模式中消除左递归。                                          
<table align=center width=400>
</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.12.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>

5.13 考虑对LR(1)文法L→Lb|a的下面的修改: <br>                  
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L→MLb|a <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;M→ε <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(a)试问在输入符号串abbb的分析树中,自底向上分析程序以怎样的顺序使用产生式? 
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(b)说明这一经过修改的文法不是LR(1)文法。
<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.13.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> 


5.14 对于带有继承属性的自底向上的分析和翻译的算法5.2,使用标记非终结符号来保存继承属性的值于分析栈中可预定的位置上。如果这样的值放在与分析栈分开的栈中,就可能需要较少的标记非终绪符号。                  
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;(a)把表5.10中的语法制导定义转化为翻译模式。 <br>
        &nbsp;&nbsp;&nbsp;&nbsp;(b)修改(a)中的翻译模式,使继承属性ps的值出现在分开的栈中。在处理过程中消除标记非终结符号M。 
<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.14.htm','','left=50,top=40,toolbar=no,scrollbars=yes,width=600,height=600')"></img>
</td></tr>
</table>
<a name=5.15></a>
<hr size=2 align=center color=red><br>                

5.15 填空:从供选择的答案中选出应填入下面陈述中(&nbsp; )处的答案.<br>                           
&nbsp;&nbsp;&nbsp;&nbsp;                           
描述文法符号语义的属性有两种,一种称为( A ),另一种称为(                           
B ).( A )值的计算依赖于分析树中它的( C )的属性值;( B )的值的计算依赖于分析树中它的(                           
D )的属性值。<br>                          
&nbsp;&nbsp;&nbsp;&nbsp; 供选择的答案:<br>                        
&nbsp;&nbsp;&nbsp;&nbsp; A,B: <span style="font-family:宋体;mso-ascii-font-family:&quot;Times New Roman&quot;;                        
mso-hansi-font-family:&quot;Times New Roman&quot;">①L-属性 ②R-属性           
③综合属性 ④继承属性<br>&nbsp;&nbsp;&nbsp;&nbsp; C,D: </span>         
 <span style="font-family:宋体;mso-ascii-font-family:&quot;Times New Roman&quot;;
mso-hansi-font-family:&quot;Times New Roman&quot;">①父结点 </span>         
<span style="font-family:宋体;mso-ascii-font-family:&quot;Times New Roman&quot;;
mso-hansi-font-family:&quot;Times New Roman&quot;">②子结点           
③兄弟结点 ④父结点与子结点 ⑤父结点与兄弟结点</span>         
<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.15.htm','','left=50,top=40,toolbar=no,scrollbars=yes,width=600,height=450')"></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.0b.htm'" ></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='5.9.0d.htm'"></img></td>
</tr>
</table>

</BODY>

⌨️ 快捷键说明

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