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

📄 2.5.2.htm

📁 建立《编译原理网络课程》的目的不仅使学生掌握构造编译程序的原理和技术
💻 HTM
字号:
<html>
<head>
<title>2.2的解答</title>
</head>
<body background="../images/background.gif">
<center><font class="title2"><b>练习2.2</b></font></center><br>
解答:<br>
(a) 句子abab有如下两个不同的最左推导:<br>
&nbsp &nbsp S <img src="IMG/equal.gif"></img> aSbS <img src="IMG/equal.gif"></img> abS <img src="IMG/equal.gif"></img> abaSbS <img src="IMG/equal.gif"></img> ababS <img src="IMG/equal.gif"></img> abab<br>
&nbsp &nbsp S <img src="IMG/equal.gif"></img> aSbS <img src="IMG/equal.gif"></img> abSaSbS <img src="IMG/equal.gif"></img> abaSbS <img src="IMG/equal.gif"></img> ababS <img src="IMG/equal.gif"></img> abab<br>
&nbsp &nbsp 所以此文法是二义性的。<br>
(b) 句子abab的两个相应的最右推导:<br>
&nbsp &nbsp S <img src="IMG/equal.gif"></img> aSbS <img src="IMG/equal.gif"></img> aSbaSbS <img src="IMG/equal.gif"></img> aSbaSb <img src="IMG/equal.gif"></img> aSbab <img src="IMG/equal.gif"></img> abab<br>
&nbsp &nbsp S <img src="IMG/equal.gif"></img> aSbS <img src="IMG/equal.gif"></img> aSb <img src="IMG/equal.gif"></img> abSaSb <img src="IMG/equal.gif"></img> abSab <img src="IMG/equal.gif"></img> abab<br>
(c> 句子abab的两棵分析树:
<table border=0>
<tr>
<td>&nbsp(一)</td>
<td>&nbsp &nbsp(二)</td>
</tr>
<tr>
<td>&nbsp<img src="IMG/2.5.2-2.gif"></td>
<td>&nbsp &nbsp<img src="IMG/2.5.2-1.gif"></td>
</tr>
</table>
(d) 此文法产生的语言是:所有a的个数与b的个数相等的由a和b组成<br>
&nbsp &nbsp 的字符串。
</body>
<html>

⌨️ 快捷键说明

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