fool2fish / dragon-book-exercise-answers

Compilers Principles, Techniques, & Tools (purple dragon book) second edition exercise answers. 编译原理(紫龙书)第2版习题答案。
6.37k stars 1.77k forks source link

Fix 5.3.2 solution #192

Closed HollowMan6 closed 3 months ago

HollowMan6 commented 3 years ago

The original solution can't work out the following examples correctly:

We don't need a property for if the expression is wrapped or not. Just write the wrapped expression (if applicable) into expr and cleanExpr if not, then it's done!

Always remember a+(b+c) does not equals a+b+c since they have completely different calulation order.