Introduction To Compiler
Introduction To Compiler
By:
Trusha R. Patel
Asst. Prof.
CE Dept., CSPIT, CHARUSAT
Basic
• Software running on all computers was written in some
programming language
Source Target
program Compiler program
Output
Interpreter
• Language processor
Source
program
Interpreter Output
Input
Compiler vs. Interpreter
• Compiler
• Interpreter
Translator
Intermediate program
(bytecode)
Interpreter Output
Input
Language Processors
• Source program may be divided into modules (stored in
different files)
• Task of collecting source program and expansion of shorthand
(macro) is done by Preprocessor
Preprocessor
Library files
Relocatable object files
Modified
Compiler
source program
Target
Assembler
assembly program
Relocatable
Loader/Linker
Machine code
Compiler
Analysis Synthesis
Structure of Compiler
Compiler
Analysis Synthesis
Compiler
Analysis Synthesis
Compiler
IR
Source program Analysis Synthesis Target program
Error
Structure of Compiler
Compiler
IR
Source program Front end Back end Target program
Error
Structure of Compiler
• Phase
IR IR IR
Back-end phases
Machine code
Grouping of Phases
Source language
Front-end phases
IR
2. Scanner generators
• Produce lexical analyzers from regular expression description
6. Compiler-construction toolkits
• Provide integrated set of routines for constructing various phases of
compiler
END