classification of compilers
DESCRIPTION
Classification of Compilers Single Pass Compilers Two Pass Compilers Multipass CompilersTRANSCRIPT
Lecture 2
Classification of Compilers
1. Single Pass Compilers
2. Two Pass Compilers
3. Multipass Compilers
Single Pass Compiler
• Source code directly transforms into machine code.– For example Pascal
sourcecode
targetcode
Front EndCompiler
Two Pass Compiler
• Use intermediate representation – Why?
sourcecode
targetcode
Front End Back EndIR
Front End
Two pass compiler
• intermediate representation (IR) • front end maps legal code into IR • back end maps IR onto target machine • simplify retargeting • allows multiple front ends • multiple passes better code
5
© Oscar Nierstrasz
Multipass compiler
• analyzes and changes IR • goal is to reduce runtime • must preserve values
6
Comparison
• One pass compilers are generally faster than Multipass Compilers
• Multipass ensures the correctness of small program rather than the correctness of a large program (high quality code)