Chap. 6, Intermediate Code Generation: J. H. Wang Dec. 17, 2008
Chap. 6, Intermediate Code Generation: J. H. Wang Dec. 17, 2008
Chap. 6, Intermediate Code Generation: J. H. Wang Dec. 17, 2008
6, Intermediate Code
Generation
J. H. Wang
Dec. 17, 2008
Outline
• Variants of Syntax Trees
• Three-Address Code
• Types and Declarations
• Translation of Expressions
• Type Checking
• Control Flow
• Backpatching
• Switch-Statements
• Intermediate Code for Procedures
Introduction
• In analysis-synthesis model of compiler
– Front end
• Details of source language
– Back end
• Details of target machine
• Intermediate code generation
– Intermediate representation
• Syntax trees
• Three-address code
– Static checking
• Type checking
• Remaining syntactic checks
Structure of Compiler Front End
source
program Intermediate
Intermediate Intermediate
Parser Static
Static Code
Code
Parser Code
Code
Checker
Checker code Generation
Generation
Generation
Generation