Exercises for Week 48#
This week’s exercises focus on advanced code generation and compiler optimizations.
Exercise 1 – design of nested functions in Dolphin#
The programming language in Appel’s textbook supports the feature of nested functions. Present a detailed outline and analysis of how you would support extending Dolphin with nested functions.
What syntax do you propose for nested functions?
How would the semantic analysis change?
How would the code generation to LLVM need to take into account the issues of scoping, i.e., accessing variable declared in parent functions.
How would loops and break statements interplay with nested functions.
Exercies 2 – basic optimizations#
give examples of optimizations that improve performance at the cost of extra space.
Exercise 3 – loop optimizations#
Work through the Exercise 18.1 in Appel’s textbook.