编译原理(紫龙书)中文第2版习题答案
前言
Exercises for Section 1.1
Exercises for Section 1.3
Exercises for Section 1.6
Exercises for Section 2.2
Exercises for Section 2.3
Exercises for Section 2.4
Exercises for Section 2.6
Exercises for Section 2.8
第2章要点
Exercises for Section 3.1
Exercises for Section 3.3
Exercises for Section 3.4
Exercises for Section 3.5
Exercises for Section 3.6
Exercises for Section 3.7
Exercises for Section 3.8
Exercises for Section 3.9
第3章要点
Exercises for Section 4.2
Exercises for Section 4.3
Exercises for Section 4.4
Exercises for Section 4.5
Exercises for Section 4.6
Exercises for Section 4.7
第4章要点
Exercises for Section 5.1
Exercises for Section 5.2
Exercises for Section 5.3
Exercises for Section 5.4
Exercises for Section 5.5
Exercises for Section 6.1
Exercises for Section 6.2
Exercises for Section 6.3
Exercises for Section 6.4
Exercises for Section 6.5
Exercises for Section 6.6
Exercises for Section 6.7
Exercises for Section 7.2
Exercises for Section 7.3
Exercises for Section 7.4
Exercises for Section 7.5
Exercises for Section 7.6
Exercises for Section 7.7
Exercises for Section 8.2
Exercises for Section 8.3
Exercises for Section 8.4
Exercises for Section 8.5
Exercises for Section 12.3
主页
资讯
文章
代码
电子书
6.1 节的练习
为下面的表达式构造 DAG
((x+y)-((x+y)*(x-y)))+((x+y)*(x-y))
解答
为下列表达式构造 DAG,且指出他们每个子表达式的值编码。假定 + 是左结合的。
a+b+(a+b)
a+b+a+b
a+a+(a+a+a+(a+a+a+a))
解答
a+b+(a+b)
1
id
a
2
id
b
3
+
1
2
4
+
3
3
a+b+a+b
1
id
a
2
id
b
3
+
1
2
4
+
3
1
5
+
4
2
a+a+(a+a+a+(a+a+a+a))
1
id
a
2
+
1
1
3
+
2
1
4
+
3
1
5
+
3
4
6
+
2
5