This document provides an overview of three-address code (TAC) as an intermediate representation for code generation. It discusses how TAC represents simple expressions, control flow statements like if/else and while loops, and function calls. Key aspects of TAC include:
- Using at most three operands per instruction
- Introducing temporary variables when needed
- Explicit labels and jumps for control flow
- Pushing and popping parameters at function calls
- Managing stack frames for local variables and parameters
The document provides examples of TAC code for simple expressions, control flow, and full Decaf programs to illustrate how different language constructs are lowered to the TAC IR.