📄 5.9.0c.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>    </td>
<td class="content">
*5.11 扩充5.5节中消除左递归的转换,使翻译模式(5.2)中的非终结符号A允许: <br>
(a)由复写规则决定的继承属性。 <br>
(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>
L→MLb|a <br>
M→ε <br>
(a)试问在输入符号串abbb的分析树中,自底向上分析程序以怎样的顺序使用产生式?
<br>
(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>
(a)把表5.10中的语法制导定义转化为翻译模式。 <br>
(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 填空:从供选择的答案中选出应填入下面陈述中( )处的答案.<br>
描述文法符号语义的属性有两种,一种称为( A ),另一种称为(
B ).( A )值的计算依赖于分析树中它的( C )的属性值;( B )的值的计算依赖于分析树中它的(
D )的属性值。<br>
供选择的答案:<br>
A,B: <span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">①L-属性 ②R-属性
③综合属性 ④继承属性<br> C,D: </span>
<span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">①父结点 </span>
<span style="font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">②子结点
③兄弟结点 ④父结点与子结点 ⑤父结点与兄弟结点</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 + -