Torben Ægidius Mogensen's "Basics of Compiler Design, Chapter 7: Intermediate-Code Generation"

Do Exercise 7.1 on page 173 and Exercise 8.2 on page 189.

These exercises will give you some practice with code generation and are based on Chapter 7, which covers intermediate code generation, and Chapter 8, which covers machine code generation. Intermediate code can be high level, i.e. close to the input language, or low level, i.e. close to the target machine language, and, hence, though Exercise #2 jumps to Chapter 8, the process of syntax directed translation is the same. These exercises illustrate the process for syntax directed translation to intermediate code or machine code. You can check your answers against the Answer Key.