classification of compilers

7
Lecture 2

Upload: sarmad-ali

Post on 22-May-2015

1.400 views

Category:

Technology


5 download

DESCRIPTION

Classification of Compilers Single Pass Compilers Two Pass Compilers Multipass Compilers

TRANSCRIPT

Page 1: Classification of Compilers

Lecture 2

Page 2: Classification of Compilers

Classification of Compilers

1. Single Pass Compilers

2. Two Pass Compilers

3. Multipass Compilers

Page 3: Classification of Compilers

Single Pass Compiler

• Source code directly transforms into machine code.– For example Pascal

sourcecode

targetcode

Front EndCompiler

Page 4: Classification of Compilers

Two Pass Compiler

• Use intermediate representation – Why?

sourcecode

targetcode

Front End Back EndIR

Front End

Page 5: Classification of Compilers

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

Page 6: Classification of Compilers

© Oscar Nierstrasz

Multipass compiler

• analyzes and changes IR • goal is to reduce runtime • must preserve values

6

Page 7: Classification of Compilers

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)