P1
姓名:田昊东 学号:211275022
注意!!!作业内容没有对过答案,存在不少错误,仅供参考!!!
推荐:菜鸡姜姜-CSDN博客
编译原理作业p1¶
3.3.2
- 以\(a\)开头和结尾的,由\(a\)和\(b\)构成的任意长度的字符串
3.3.5
consonant -> [b-d]|[f-h]|[j-n]|[p-t]|[v-z]
res->consonant*a(consonant|a)*e(consonant|e)*i(consonant|i)*
o(consonant|o)*u(consonant|u)*
3.6.3
- 接受 \(aabb\)
- \(0\overset{a}{\rightarrow}1\overset{a}{\rightarrow}2\overset{b}{\rightarrow}2\overset{b}{\rightarrow}3\)(这条路径就说明了NFA接受aabb)
- \(0\overset{a}{\rightarrow}0\overset{a}{\rightarrow}0\overset{b}{\rightarrow}0\overset{b}{\rightarrow}0\)
3.6.5
^bf07a9
- 首先写出转换函数
- \((0,a)\rightarrow\{0,1\}\)
- \((0,b)\rightarrow\{0\}\)
- \((1,a)\rightarrow\{1,2\}\)
- \((1,b)\rightarrow\{1\}\)
- \((2,a)\rightarrow\{2\}\)
- \((2,b)\rightarrow\{2,3\}\)
- \((2,\epsilon)\rightarrow\{0\}\)
- 写出NFA转换表
状态 | a | b | \(\epsilon\) |
---|---|---|---|
0 | \(\{0,1\}\) | \(\{0\}\) | \(\phi\) |
1 | \(\{1,2\}\) | \(\{1\}\) | \(\phi\) |
2 | \(\{2\}\) | \(\{2,3\}\) | \(\{0\}\) |
3 | \(\phi\) | \(\phi\) | \(\phi\) |