📄 4.10.0.3.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='4.10.0.2b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='../c_5/5.0.htm'"></img></td>
</tr>
</table>
<br><br>
<font class="title2"><b>练习</b></font>
<table><tr><td> </td>
<td class="content">
<a name="4.21"></a>
4.21 选择题<br>
从供选择的答案中,选出应填入____内的正确答案。<br>
<p>自底向上语法分析采用__A__分析法,常用的是自底向上语法分析有算符优先分析法和LR分析法。LR分析是寻找右句型的 __B__;而算符优先分析是寻找右句型的__C__。LR分析法中分析能力最强的是__D__;分析能力最弱的是__E__。</p><br>
供选择的答案:<br>
<table align=center width=450 class="content">
<tr><td>A:</td><td>①递归</td><td>②回溯</td><td>③枚举</td><td>④移进-规约</td></tr>
<tr><td>B、C:</td><td>①短语</td><td>②素短语</td><td>③最左素短语</td><td>④句柄</td></tr>
<tr><td>D、E:</td><td>①SLR(1)</td><td>②LR(0)</td><td>③LR(1)</td><td>④LALR(1)</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('4.10.21.htm','','left=100,top=100,toolbar=no,width=500,height=500')"></img>
</td></tr>
</table>
<a name="4.22"></a>
<hr size=2 align=center color=red><br>
4.22 程序练习(协同作业)<br>
构造语法分析器(使用第三章构造的词法分析器)<br>
1、构造递归下降分析器<br>
(1) 书写出标准Pascal的语法的形式描述(BNF);<br>
(2) 消除左递归,提取左公因子;<br>
(3) 用某种高级语言书写出它的递归预测分析器。<br>
2、构造LL(1)分析器:<br>
(1) 书写出标准Pascal的语法的形式描述(BNF);<br>
(2) 消除左递归,提取左公因子;<br>
(3) 构造其LL(1)分析表和LL(1)驱动程序。
<br>
3、使用软件工具Yacc,构造LALR分析器<br>
(1) 书写出标准Pascal的语法的形式描述(BNF);<br>
(2) 书写出Yacc的源程序;<br>
(3) 用Yacc生成LALR分析器。<br>
每小组选择完成本作业1、2、3中之一,也可以把Pascal改成C,然后交流。
</table>
<br>
<table align=right width=300>
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.10.0.2b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='../c_5/5.0.htm'"></img></td>
</tr>
</table>
</BODY>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -