Professional Documents
Culture Documents
Compilers and
Interpreters
Compilation
Compiler
Target
Program
Errormessages
Output
Source
Program
Interpreter
Output
Input
Errormessages
a program that
translates an executable program
in one language into an executable
program in another language
Interpreter:
The Analysis-Synthesis
Model of Compilation
There
The Analysis-Synthesis
Model of Compilation
Synthesis
(contd)
Constructs
target
program
from
intermediate representation
Takes the tree structure and translates the
operations into the target program
Known as back end of compiler
A language-processing
system
SkeletalSourceProgram
Preprocessor
SourceProgram
Compiler
TargetAssemblyProgram
Assembler
RelocatableObjectCode
Linker
AbsoluteMachineCode
Librariesand
RelocatableObjectFiles
7
Analysis
In
Lexical analysis
Characters
10
structure usually
expressed by recursive rules
Rules for definition of expression:
11
Semantic analysis
Checks
12
Phases of a compiler
13
Symbol-Table
Management
Symbol
14
Intermediate code
generation
Program
representation for an
abstract machine
Should have two properties
Easy to produce
Easy to translate into target program
Three-address
code is a
commonly used form similar to
assembly language
15
Optimization
Generation
16
17
Front end:
Analysis steps + Intermediate code generation
Depends primarily on the source language
Machine independent
Back end:
Code optimization and generation
Independent of source language
Machine dependent
18
Compiler passes:
19
Compiler-Construction
Tools
Software
Scanner generators
Parser generators
Syntax-directed translation engines
Automatic code generators
Data-flow engines
20
Thank You
21