SlideShare una empresa de Scribd logo
1 de 58
Descargar para leer sin conexión
Introduction to
Compiler
CD:COMPILER DESIGN
Department of CE
Prof. Happy Chapla
Unit no : 1
Introduction to
Compiler
(01CE0601)
Outline :
Translator
Compiler, Interpreter, Assembler
Cousins of Compiler
Phases of Compiler
Grouping of Phases
Types of Compiler
Compiler construction tools
Pass and Phase
Department of CE
Prof. Happy Chapla
Unit no : 1
Introduction to
Compiler
(01CE0601)
What is
Compiler?
Basic
Terminology
Why we
need it?
Translator
Translator
Translator :
• A translator is a program which takes one program
(written in one language) as input and converts it into
another language (Target language).
• Input Language is Source Language and Output
Language is Target Language.
• There are Three types of Translator :
1) Compiler
2) Interpreter
3) Assembler
 It also detects and reports error during translation.
Compiler
Compiler :
 Compiler is a program that reads a program written in
one language that means source language and
translates it into equivalent program into another
language that is target language.
 Compiler is a program which translates higher level
language into functionally equivalent lower level
language.
 It also detects and reports error.
Source Target
Program Program
Error
Compiler
Compiler
Compiler :
 Compiler is a program that reads a program written in
one language that means source language and
translates it into equivalent program into another
language that is target language.
 Compiler is a program which translates higher level
language into functionally equivalent lower level
language.
 It also detects and reports error.
Source Target
Program Program
Error
Compiler
Interpreter
Interpreter :
 Interpreter is a translator which is used to convert
programs in high-level language to low-level language.
 Interpreter translates line by line and reports the error
once it encountered during the translation process.
Source Target
Program Program
Error
Interpreter
Assembler
Assembler :
 An assembler is a translator used to translate
assembly language to machine language.
 An assembler translates a low-level language, an
assembly language to an even lower-level language,
which is the machine code. The machine code can be
directly understood by the CPU.
Source Target
Program Program
Error
Assembler
Compiler
Vs
Interpreter
Compiler Interpreter
It takes Whole program as input It takes single instruction as input
It generates intermediate object
code
It does not generate any
intermediate object code
Memory requirement is more due
to creation of object code.
Memory requirement is less
(memory efficient) as it does not
create intermediate object code.
It takes large amount of time to
analyze the source code but overall
execution is comparatively faster.
It takes less amount of time to
analyze the source code but overall
execution is slower.
Compilation is done before
execution.
Compilation and execution take
place simultaneously.
Display all errors after entire
program is checked.
Display errors of each line one by
one.
Ex : C , C ++ Ex : BASIC , Python
Compiler
Vs
Assembler
Compiler Assembler
Input for compiler is Pre processed
Source code.
Input for Assembler is Assembly
language code.
It generates assembly language
code or directly the executable
code.
It generates the relocatable
machine code.
There are 6 Phases of compiler It makes Two passes over given
input.
Ex : C , C ++ Ex : 8085 , 8086
Language
Processing
System
/ Translation
Processor
/ Context of
Compiler
/Cousins of
Compiler
Pre Processor
Compiler
Assembler
Linker &
Loader
HLL
Pure HLL
Assembly Language
Relocatable Machine code
Absolute Machine code
Library ,
Relocatable object files
#include<stdio.h>
printf()
{
.........
}
scanf()
#define intrt 8.5
macro
# define square(x) x*x
# pre prcessor directives
mov R1,a
mov R2,b
add R1,R2
mov c,R1
Language
Processing
System
/ Translation
Processor
/ Context of
Compiler
/Cousins of
Compiler
 There are three cousins of Compiler
1) Preprocessor
2) Assembler
3) Linker and Loader
Language
Processing
System
/ Translation
Processor
/ Context of
Compiler
/Cousins of
Compiler
1) Preprocessor
 Preprocessor produces input to compilers.
 They may perform the following functions
➢ Macro Processing : A preprocessor may allow a user to
define macros that are short hands for longer constructs.
➢File Inclusion : A preprocessor may include header files
into program text.
➢“Rational” Preprocessor : These processors augment older
languages with more modern flow of control and data
structuring facilities. (Built in Macro for construct like While
or If Statement)
➢ Language Extension : These processor attempt to add
capabilities to the language by what amount to built in
macros. the language equal is a database query language
embedded in C. statement beginning with ## are taken by
preprocessor to be database access statement unrelated to C
and translated into procedure call on routines that perform
database access.
Language
Processing
System
/ Translation
Processor
/ Context of
Compiler
/Cousins of
Compiler
1) Preprocessor
 Macro processor deal with two kinds of statement
→Macro Definition
→Macro Use
 Formal Parameters
 Actual Parameters
Language
Processing
System
/ Translation
Processor
/ Context of
Compiler
/Cousins of
Compiler
2) Assembler
 An assembler is a translator used to translate
assembly language to machine language.
 An assembler translates a low-level language, an
assembly language to an even lower-level language,
which is the machine code. The machine code can be
directly understood by the CPU.
Source Target
Program Program
Error
Assembler
Language
Processing
System
/ Translation
Processor
/ Context of
Compiler
/Cousins of
Compiler
2) Assembler
 Assembly code is mnemonic version of machine code,
in which names are used instead of binary codes for
operation and names are also given to memory address.
Language
Processing
System
/ Translation
Processor
/ Context of
Compiler
/Cousins of
Compiler
3) Linker and Loader
 A program called loader performs the two functions of
loading and link editing
 The process of loading consist of taking relocatable
machine code , altering the relocatable address and
placing the altered instructions and data in memory at
the proper location.
 Linker allows us to make a single program from several
files of relocatable machine code.
 Types of Linking : Static and Dynamic
 Types of Loader : Compile and Go loader, Absolute
Loader, Relocating Loader.
Phases of
Compiler
Lexical Analyzer
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
1) Lexical Analysis
 It is also called Linear analysis or scanning.
 In this phase, input character from source code is read
from left to right and then break into stream of units.
These units are called tokens.
 Sequence of characters having a collective meaning is
called Token.
 Tokens can be categorized into identifiers, constants,
literals, keywords, operators, delimeters etc.
 So, Token is the smallest meaningful entities of program
are produced as output.
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
1) Lexical Analysis
Example : position = initial + rate * 60
Id1 = id2 + id3 * 60
Position Identifier 1
= Equal to operator
Initial Identifier 2
+ Addition Operator
Rate Identifier 3
* Multiplication Operator
60 Constant
Phases of
Compiler
Lexical Analyzer
Syntax Analyzer
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
2) Syntax Analysis
 It is also called Hierarchical analysis or Parsing.
 It determines if the sentence formed from the words
are syntactically (grammatically) correct.
 It creates syntax tree from generated tokens if the code
is error free.
 Syntax tree consist operators as internal node and
operands as leaf node.
 This phase check each and every line and try to detect
errors if it is grammatically (syntax wise) not correct.
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
2) Syntax Analysis
position = initial + rate * 60
Three Operators : = + *
position = initial + rate * 60
position = initial + rate * 60
position = initial + rate * 60
Phases of
Compiler
Lexical Analyzer
Syntax Analyzer
Semantic
Analyzer
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
3) Semantic Analysis
 It determines meaning of string
 In semantic analysis various operations are performed
like
 Performing check ; whether operator have compatible
arguments or not (type checking) , matching of
parenthesis, scope of operation etc.
 Ensuring that components of a program fits together
meaningfully.
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
3) Semantic Analysis
position = initial + rate * 60
Phases of
Compiler
Lexical Analyzer
Syntax Analyzer
Semantic
Analyzer
Intermediate
Code Generator
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
4) Intermediate Code Generator
 Intermediate code generation should have two
properties :
it should be easy to produce,
easy to translate.
 Intermediate code is called “Three Address Code”.
 It is called three address code as it maximum consist
three operands.
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
4) Intermediate Code Generator
Example : position = initial + rate * 60
t1 = inttoreal(60)
t2 = rate * t1
t3 = initial + t2
position = t3
Phases of
Compiler
Lexical Analyzer
Syntax Analyzer
Semantic
Analyzer
Intermediate
Code Generator
Code Optimizer
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
5) Code Optimization
 This phase improves the intermediate code, in such a
way that a machine code can be produced, which
occupies less memory space and less execution time
without changing the functionality or correctness of
program.
 Example :
t1 = rate * 60.00
position = initial + t1
Phases of
Compiler
Lexical Analyzer
Syntax Analyzer
Semantic
Analyzer
Intermediate
Code Generator
Code Optimizer
Code Generator
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
6) Code Generation
 In Code generation phase the target code gets
generated.
 In this phase intermediate (optimized) code is
translated into a sequence of machine instructions that
perform the same operation.
 Example :
MOVF id3,R1
MULF #60.00, R1
MOVF id2, R2
ADDF R2, R1
MOVF R1, id1
position = initial + rate * 60
id 1 id2 id3
R1 = id3 (rate)
R1 = 60.00 * R1
R2 = id2 (initial)
R1 = R2 + R1
id1(position) = R1
Phases of
Compiler
Lexical Analyzer
Syntax Analyzer
Semantic
Analyzer
Intermediate
Code Generator
Code Optimizer
Code Generator
Symbol Table
Manager
Error
handler
Phases of
Compiler
Lexical Analyzer
Syntax Analyzer
Semantic
Analyzer
Intermediate
Code Generator
Code Optimizer
Code Generator
Symbol Table
Manager
Error
handler
Analysis Phase
Synthesis Phase
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
 There are two parts of Compilation Process :
1) Analysis Phase
It breaks up source program into small pieces and
create an intermediate representation of source
program.
2) Synthesis Phase
It constructs the desired target program from
intermediate representation.
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
1) Analysis Phase
Consist of Three Sub Phases :
 Lexical analysis
 Syntax analysis
 Semantic analysis
2) Synthesis Phase :
Consist of Three Sub Phases :
 Intermediate Code generation
 Code Optimization
 Code Generation
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
Symbol Table :
 A symbol table is data structure used by language
translators.
 In order to keep track of identifiers used by program,
compiler maintains the record of the same with their
various attributes.
 Symbol table stores information for different entities :
Identifier, Function, Procedure, Constant , Label Name,
Compiler generated temporaries etc.
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
Error Detection and Recovery :
 Each phase can encounter errors, However after
detecting an error a phase must some how deal with
that error. So that Compilation can proceed, allowing
further errors in the source program to be detected.
 Lexical Analyzer can detect errors where the character
remaining in the input do not form any token of the
language.
 Errors where the token stream violates the structure
rule (syntax) of the language are determined by syntax
analysis phase.
 During Semantic analysis, the compiler tries to detect
constructs that have the right syntactic structure but no
meaning to the operation involved.
Phases of
Compiler
/ Analysis –
Synthesis
Model of
Compilation
Lexical analyzer
Syntax analyzer
Semantic analyzer
a=b+c*60
Id1=id2+id3*60
=
+
*
60
id1
id2
id3
=
+
*
60
id1
id2
id3 Int to float
Intermediate code generator
t1:= inttofloat (60)
t2:= id3 * t1
t3:= id2 + t2
id1:= t3
Code optimizer
t1:= id3 * 60.0
id1:= id2 + t1
Code generator
MOVEF id3, R2
MULF #60.0,R2
MOVF id2, R1
ADDF R2,R1
MOVF R1,id1
Practice Time
Example :
What will be the output of each phase for the following
statement?
Statement : x = a + b * c
Solution
Grouping of
Phases
Front End
• Dependent :
Source Language
• Independent :
Target Machine
Back End
• Dependent : Target
Machine
• Independent :
Source Language
Grouping of
Phases
Front End:
 Front end consist of those phase, that depends
preliminary on the source language & are
independent of the target machine.
 It includes Lexical analysis, Syntax analysis, Semantic
analysis, Intermediate code generation and Creation
of Symbol table.
 A certain amount of code optimization can be done
by the front end as well
 The front end also includes error handling that goes
along with each of these phases.
Grouping of
Phases
Back End:
 Back includes those portion of compiler that depend
on the target machine and do not depend on source
language.
 Back end includes code optimization and code
generation with necessary error handling and
symbol table operation.
It has become fairly routine to take front end of a
compiler & redo its back end to produce a compiler for
the same source language on a different machine.
Pass of
Compiler
 One Complete scan of Source program is called Pass.
 Difficulty in single pass :
→ Forward Reference : A forward reference means
variable or label is referenced before its declared.
 It leads to Multi-Pass model.
Pass – 1 : Perform analysis of source program and note
relevant information
Pass – 2 : Generate target code using information
noted in pass-1.
Pass Vs Phase
Pass Phase
Various phases are logically grouped
together to form a pass.
The process of compilation is carried
out in various step is called Phase.
Require Less Memory Require More Memory
Execution is faster Execution is slower
Less memory operation(read/write)
to be performed
More memory operations to be
performed
2 Passes of Compiler 6 Phases of Compiler
Types of
Compiler
Native Compiler Cross Compiler
Source to Source
Compiler
Just inTime Compiler
Incremental Compiler Parallelizing Compiler
Types of
Compiler
Native Compiler :
 The compiler used to Compile a source code for
same type of platform only.
 The compiler used to compile a source code for same
type of platform only. The output generated by this
type of compiler can only be run on the same type of
computer system and OS that the compiler itself runs
on.
Cross Compiler :
 The compiler used to compile a source code for
different kinds platform.
 A Cross compiler is a compiler capable of creating
executable code for a platform other than one on
which compiler is running.
Types of
Compiler
Source to Source Compiler :
 The compiler that takes high-level language code as
input and outputs source code of another high- level
language only.
 Unlike other compilers which convert high level
language into low level machine language, it can take
up a code written in Pascal and can transform it into
C-conversion of one high level language into another
high level language having same type of abstraction .
 Thus, it is also known as transpiler .
Types of
Compiler
Just in Time Compiler :
 The compiler which converts a code into machine
code after the program starts execution.
 Convert .java file into .class file.
Types of
Compiler
Incremental Compiler :
 The compiler which compiles only the changed lines
from the source code and update the object code.
Parallelizing Compiler :
 A Compiler which is specially designed to run in
parallel computer architecture is known as
parallelizing compiler.
int a=0;
int b=1;
printf("Enter Input");
Scanf();
if(a==10)
printf();
Compiler
Construction
Tools
Compiler Construction Tools :
1) Scanner Generators
2) Parser Generators
3) Syntax – directed translation engines
4) Automatic Code Generators
5) Data Flow Engine
Compiler
Construction
Tools
Scanner generators: This tool takes regular expressions as
input. For example LEX for Unix Operating System.
Parser generators: A parser generator takes a grammar as
input and automatically generates source code which can
parse streams of characters with the help of a grammar
Syntax-directed translation engines: These software
tools offer an intermediate code by using the parse tree. It
has a goal of associating one or more translations with each
node of the parse tree.
Automatic code generators: Takes intermediate code and
converts them into Machine Language
Data-flow engines: This tool is helpful for code
optimization. Here, information is supplied by user and
intermediate code is compared to analyze any relation. It is
also known as data-flow analysis. It helps you to find out
how values are transmitted from one part of the program to
another part.
Qualities of
Compiler
 Compiler itself must be bug free.
 It must generate correct machine code.
 Generated machine code must run fast (Execution
speed).
 Compilation time must be less.
 Compilation must be portable.
 It must be print good diagnostics and Error message.
 Generated code must work well with existing debugger.
 It must have consistent and Predictable optimization.
References
1. Aho, Lam, Sethi, and Ullman, Compilers: Principles,
Techniques andTools,SecondEdition, Pearson, 2014
2. D. M. Dhamdhere: Systerm Programming, Mc Graw
Hill Publication
3. Dick Grune, Henri E. Bal, Jacob, Langendoen:
Modern Compiler Design, Wiley India Publication
MU Questions
1) Develop Analysis – Synthesis model of Compiler for a
= b + c * 20. Write down explanation and output for
each phase of compiler.
2) Difference between Compiler and Interpreter.
3) Explain Cousins of compiler.
4) Give the name of Front End and Back End with
explanation, and take one example to show the
output of the every phase.
Thanks
Prof. Happy Chapla

Más contenido relacionado

La actualidad más candente

La actualidad más candente (19)

Compiler
Compiler Compiler
Compiler
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Compiler
Compiler Compiler
Compiler
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overview
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
compiler and their types
compiler and their typescompiler and their types
compiler and their types
 
Presentation compiler design
Presentation compiler designPresentation compiler design
Presentation compiler design
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)
 
Classification of Compilers
Classification of CompilersClassification of Compilers
Classification of Compilers
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
Compilers
CompilersCompilers
Compilers
 
Introduction to Compiler
Introduction to CompilerIntroduction to Compiler
Introduction to Compiler
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 

Similar a Chapter1pdf__2021_11_23_10_53_20.pdf

unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfDrIsikoIsaac
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptxssuser3b4934
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxdawod yimer
 
Chapter-1.pptx compiler Design Course Material
Chapter-1.pptx compiler Design Course MaterialChapter-1.pptx compiler Design Course Material
Chapter-1.pptx compiler Design Course MaterialgadisaAdamu
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction Thapar Institute
 
Pros and cons of c as a compiler language
  Pros and cons of c as a compiler language  Pros and cons of c as a compiler language
Pros and cons of c as a compiler languageAshok Raj
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfadvRajatSharma
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdfAkarTaher
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution pptKeerty Smile
 
SSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfSSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfJacobDragonette
 

Similar a Chapter1pdf__2021_11_23_10_53_20.pdf (20)

unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdf
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptx
 
Chapter-1.pptx compiler Design Course Material
Chapter-1.pptx compiler Design Course MaterialChapter-1.pptx compiler Design Course Material
Chapter-1.pptx compiler Design Course Material
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
3.2
3.23.2
3.2
 
Pros and cons of c as a compiler language
  Pros and cons of c as a compiler language  Pros and cons of c as a compiler language
Pros and cons of c as a compiler language
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 
Assignment1
Assignment1Assignment1
Assignment1
 
How a Compiler Works ?
How a Compiler Works ?How a Compiler Works ?
How a Compiler Works ?
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdf
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
SSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfSSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdf
 
COMPILER DESIGN.docx
COMPILER DESIGN.docxCOMPILER DESIGN.docx
COMPILER DESIGN.docx
 
COMPILER DESIGN PPTS.pptx
COMPILER DESIGN PPTS.pptxCOMPILER DESIGN PPTS.pptx
COMPILER DESIGN PPTS.pptx
 

Último

ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSrknatarajan
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 

Último (20)

ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 

Chapter1pdf__2021_11_23_10_53_20.pdf

  • 1. Introduction to Compiler CD:COMPILER DESIGN Department of CE Prof. Happy Chapla Unit no : 1 Introduction to Compiler (01CE0601)
  • 2. Outline : Translator Compiler, Interpreter, Assembler Cousins of Compiler Phases of Compiler Grouping of Phases Types of Compiler Compiler construction tools Pass and Phase Department of CE Prof. Happy Chapla Unit no : 1 Introduction to Compiler (01CE0601)
  • 5. Translator Translator : • A translator is a program which takes one program (written in one language) as input and converts it into another language (Target language). • Input Language is Source Language and Output Language is Target Language. • There are Three types of Translator : 1) Compiler 2) Interpreter 3) Assembler  It also detects and reports error during translation.
  • 6. Compiler Compiler :  Compiler is a program that reads a program written in one language that means source language and translates it into equivalent program into another language that is target language.  Compiler is a program which translates higher level language into functionally equivalent lower level language.  It also detects and reports error. Source Target Program Program Error Compiler
  • 7. Compiler Compiler :  Compiler is a program that reads a program written in one language that means source language and translates it into equivalent program into another language that is target language.  Compiler is a program which translates higher level language into functionally equivalent lower level language.  It also detects and reports error. Source Target Program Program Error Compiler
  • 8. Interpreter Interpreter :  Interpreter is a translator which is used to convert programs in high-level language to low-level language.  Interpreter translates line by line and reports the error once it encountered during the translation process. Source Target Program Program Error Interpreter
  • 9. Assembler Assembler :  An assembler is a translator used to translate assembly language to machine language.  An assembler translates a low-level language, an assembly language to an even lower-level language, which is the machine code. The machine code can be directly understood by the CPU. Source Target Program Program Error Assembler
  • 10. Compiler Vs Interpreter Compiler Interpreter It takes Whole program as input It takes single instruction as input It generates intermediate object code It does not generate any intermediate object code Memory requirement is more due to creation of object code. Memory requirement is less (memory efficient) as it does not create intermediate object code. It takes large amount of time to analyze the source code but overall execution is comparatively faster. It takes less amount of time to analyze the source code but overall execution is slower. Compilation is done before execution. Compilation and execution take place simultaneously. Display all errors after entire program is checked. Display errors of each line one by one. Ex : C , C ++ Ex : BASIC , Python
  • 11. Compiler Vs Assembler Compiler Assembler Input for compiler is Pre processed Source code. Input for Assembler is Assembly language code. It generates assembly language code or directly the executable code. It generates the relocatable machine code. There are 6 Phases of compiler It makes Two passes over given input. Ex : C , C ++ Ex : 8085 , 8086
  • 12. Language Processing System / Translation Processor / Context of Compiler /Cousins of Compiler Pre Processor Compiler Assembler Linker & Loader HLL Pure HLL Assembly Language Relocatable Machine code Absolute Machine code Library , Relocatable object files #include<stdio.h> printf() { ......... } scanf() #define intrt 8.5 macro # define square(x) x*x # pre prcessor directives mov R1,a mov R2,b add R1,R2 mov c,R1
  • 13. Language Processing System / Translation Processor / Context of Compiler /Cousins of Compiler  There are three cousins of Compiler 1) Preprocessor 2) Assembler 3) Linker and Loader
  • 14. Language Processing System / Translation Processor / Context of Compiler /Cousins of Compiler 1) Preprocessor  Preprocessor produces input to compilers.  They may perform the following functions ➢ Macro Processing : A preprocessor may allow a user to define macros that are short hands for longer constructs. ➢File Inclusion : A preprocessor may include header files into program text. ➢“Rational” Preprocessor : These processors augment older languages with more modern flow of control and data structuring facilities. (Built in Macro for construct like While or If Statement) ➢ Language Extension : These processor attempt to add capabilities to the language by what amount to built in macros. the language equal is a database query language embedded in C. statement beginning with ## are taken by preprocessor to be database access statement unrelated to C and translated into procedure call on routines that perform database access.
  • 15. Language Processing System / Translation Processor / Context of Compiler /Cousins of Compiler 1) Preprocessor  Macro processor deal with two kinds of statement →Macro Definition →Macro Use  Formal Parameters  Actual Parameters
  • 16. Language Processing System / Translation Processor / Context of Compiler /Cousins of Compiler 2) Assembler  An assembler is a translator used to translate assembly language to machine language.  An assembler translates a low-level language, an assembly language to an even lower-level language, which is the machine code. The machine code can be directly understood by the CPU. Source Target Program Program Error Assembler
  • 17. Language Processing System / Translation Processor / Context of Compiler /Cousins of Compiler 2) Assembler  Assembly code is mnemonic version of machine code, in which names are used instead of binary codes for operation and names are also given to memory address.
  • 18. Language Processing System / Translation Processor / Context of Compiler /Cousins of Compiler 3) Linker and Loader  A program called loader performs the two functions of loading and link editing  The process of loading consist of taking relocatable machine code , altering the relocatable address and placing the altered instructions and data in memory at the proper location.  Linker allows us to make a single program from several files of relocatable machine code.  Types of Linking : Static and Dynamic  Types of Loader : Compile and Go loader, Absolute Loader, Relocating Loader.
  • 20. Phases of Compiler / Analysis – Synthesis Model of Compilation 1) Lexical Analysis  It is also called Linear analysis or scanning.  In this phase, input character from source code is read from left to right and then break into stream of units. These units are called tokens.  Sequence of characters having a collective meaning is called Token.  Tokens can be categorized into identifiers, constants, literals, keywords, operators, delimeters etc.  So, Token is the smallest meaningful entities of program are produced as output.
  • 21. Phases of Compiler / Analysis – Synthesis Model of Compilation 1) Lexical Analysis Example : position = initial + rate * 60 Id1 = id2 + id3 * 60 Position Identifier 1 = Equal to operator Initial Identifier 2 + Addition Operator Rate Identifier 3 * Multiplication Operator 60 Constant
  • 23. Phases of Compiler / Analysis – Synthesis Model of Compilation 2) Syntax Analysis  It is also called Hierarchical analysis or Parsing.  It determines if the sentence formed from the words are syntactically (grammatically) correct.  It creates syntax tree from generated tokens if the code is error free.  Syntax tree consist operators as internal node and operands as leaf node.  This phase check each and every line and try to detect errors if it is grammatically (syntax wise) not correct.
  • 24. Phases of Compiler / Analysis – Synthesis Model of Compilation 2) Syntax Analysis position = initial + rate * 60 Three Operators : = + * position = initial + rate * 60 position = initial + rate * 60 position = initial + rate * 60
  • 25. Phases of Compiler Lexical Analyzer Syntax Analyzer Semantic Analyzer
  • 26. Phases of Compiler / Analysis – Synthesis Model of Compilation 3) Semantic Analysis  It determines meaning of string  In semantic analysis various operations are performed like  Performing check ; whether operator have compatible arguments or not (type checking) , matching of parenthesis, scope of operation etc.  Ensuring that components of a program fits together meaningfully.
  • 27. Phases of Compiler / Analysis – Synthesis Model of Compilation 3) Semantic Analysis position = initial + rate * 60
  • 28. Phases of Compiler Lexical Analyzer Syntax Analyzer Semantic Analyzer Intermediate Code Generator
  • 29. Phases of Compiler / Analysis – Synthesis Model of Compilation 4) Intermediate Code Generator  Intermediate code generation should have two properties : it should be easy to produce, easy to translate.  Intermediate code is called “Three Address Code”.  It is called three address code as it maximum consist three operands.
  • 30. Phases of Compiler / Analysis – Synthesis Model of Compilation 4) Intermediate Code Generator Example : position = initial + rate * 60 t1 = inttoreal(60) t2 = rate * t1 t3 = initial + t2 position = t3
  • 31. Phases of Compiler Lexical Analyzer Syntax Analyzer Semantic Analyzer Intermediate Code Generator Code Optimizer
  • 32. Phases of Compiler / Analysis – Synthesis Model of Compilation 5) Code Optimization  This phase improves the intermediate code, in such a way that a machine code can be produced, which occupies less memory space and less execution time without changing the functionality or correctness of program.  Example : t1 = rate * 60.00 position = initial + t1
  • 33. Phases of Compiler Lexical Analyzer Syntax Analyzer Semantic Analyzer Intermediate Code Generator Code Optimizer Code Generator
  • 34. Phases of Compiler / Analysis – Synthesis Model of Compilation 6) Code Generation  In Code generation phase the target code gets generated.  In this phase intermediate (optimized) code is translated into a sequence of machine instructions that perform the same operation.  Example : MOVF id3,R1 MULF #60.00, R1 MOVF id2, R2 ADDF R2, R1 MOVF R1, id1 position = initial + rate * 60 id 1 id2 id3 R1 = id3 (rate) R1 = 60.00 * R1 R2 = id2 (initial) R1 = R2 + R1 id1(position) = R1
  • 35. Phases of Compiler Lexical Analyzer Syntax Analyzer Semantic Analyzer Intermediate Code Generator Code Optimizer Code Generator Symbol Table Manager Error handler
  • 36. Phases of Compiler Lexical Analyzer Syntax Analyzer Semantic Analyzer Intermediate Code Generator Code Optimizer Code Generator Symbol Table Manager Error handler Analysis Phase Synthesis Phase
  • 37. Phases of Compiler / Analysis – Synthesis Model of Compilation  There are two parts of Compilation Process : 1) Analysis Phase It breaks up source program into small pieces and create an intermediate representation of source program. 2) Synthesis Phase It constructs the desired target program from intermediate representation.
  • 38. Phases of Compiler / Analysis – Synthesis Model of Compilation 1) Analysis Phase Consist of Three Sub Phases :  Lexical analysis  Syntax analysis  Semantic analysis 2) Synthesis Phase : Consist of Three Sub Phases :  Intermediate Code generation  Code Optimization  Code Generation
  • 39. Phases of Compiler / Analysis – Synthesis Model of Compilation Symbol Table :  A symbol table is data structure used by language translators.  In order to keep track of identifiers used by program, compiler maintains the record of the same with their various attributes.  Symbol table stores information for different entities : Identifier, Function, Procedure, Constant , Label Name, Compiler generated temporaries etc.
  • 40. Phases of Compiler / Analysis – Synthesis Model of Compilation Error Detection and Recovery :  Each phase can encounter errors, However after detecting an error a phase must some how deal with that error. So that Compilation can proceed, allowing further errors in the source program to be detected.  Lexical Analyzer can detect errors where the character remaining in the input do not form any token of the language.  Errors where the token stream violates the structure rule (syntax) of the language are determined by syntax analysis phase.  During Semantic analysis, the compiler tries to detect constructs that have the right syntactic structure but no meaning to the operation involved.
  • 41. Phases of Compiler / Analysis – Synthesis Model of Compilation Lexical analyzer Syntax analyzer Semantic analyzer a=b+c*60 Id1=id2+id3*60 = + * 60 id1 id2 id3 = + * 60 id1 id2 id3 Int to float Intermediate code generator t1:= inttofloat (60) t2:= id3 * t1 t3:= id2 + t2 id1:= t3 Code optimizer t1:= id3 * 60.0 id1:= id2 + t1 Code generator MOVEF id3, R2 MULF #60.0,R2 MOVF id2, R1 ADDF R2,R1 MOVF R1,id1
  • 42. Practice Time Example : What will be the output of each phase for the following statement? Statement : x = a + b * c Solution
  • 43. Grouping of Phases Front End • Dependent : Source Language • Independent : Target Machine Back End • Dependent : Target Machine • Independent : Source Language
  • 44. Grouping of Phases Front End:  Front end consist of those phase, that depends preliminary on the source language & are independent of the target machine.  It includes Lexical analysis, Syntax analysis, Semantic analysis, Intermediate code generation and Creation of Symbol table.  A certain amount of code optimization can be done by the front end as well  The front end also includes error handling that goes along with each of these phases.
  • 45. Grouping of Phases Back End:  Back includes those portion of compiler that depend on the target machine and do not depend on source language.  Back end includes code optimization and code generation with necessary error handling and symbol table operation. It has become fairly routine to take front end of a compiler & redo its back end to produce a compiler for the same source language on a different machine.
  • 46. Pass of Compiler  One Complete scan of Source program is called Pass.  Difficulty in single pass : → Forward Reference : A forward reference means variable or label is referenced before its declared.  It leads to Multi-Pass model. Pass – 1 : Perform analysis of source program and note relevant information Pass – 2 : Generate target code using information noted in pass-1.
  • 47. Pass Vs Phase Pass Phase Various phases are logically grouped together to form a pass. The process of compilation is carried out in various step is called Phase. Require Less Memory Require More Memory Execution is faster Execution is slower Less memory operation(read/write) to be performed More memory operations to be performed 2 Passes of Compiler 6 Phases of Compiler
  • 48. Types of Compiler Native Compiler Cross Compiler Source to Source Compiler Just inTime Compiler Incremental Compiler Parallelizing Compiler
  • 49. Types of Compiler Native Compiler :  The compiler used to Compile a source code for same type of platform only.  The compiler used to compile a source code for same type of platform only. The output generated by this type of compiler can only be run on the same type of computer system and OS that the compiler itself runs on. Cross Compiler :  The compiler used to compile a source code for different kinds platform.  A Cross compiler is a compiler capable of creating executable code for a platform other than one on which compiler is running.
  • 50. Types of Compiler Source to Source Compiler :  The compiler that takes high-level language code as input and outputs source code of another high- level language only.  Unlike other compilers which convert high level language into low level machine language, it can take up a code written in Pascal and can transform it into C-conversion of one high level language into another high level language having same type of abstraction .  Thus, it is also known as transpiler .
  • 51. Types of Compiler Just in Time Compiler :  The compiler which converts a code into machine code after the program starts execution.  Convert .java file into .class file.
  • 52. Types of Compiler Incremental Compiler :  The compiler which compiles only the changed lines from the source code and update the object code. Parallelizing Compiler :  A Compiler which is specially designed to run in parallel computer architecture is known as parallelizing compiler. int a=0; int b=1; printf("Enter Input"); Scanf(); if(a==10) printf();
  • 53. Compiler Construction Tools Compiler Construction Tools : 1) Scanner Generators 2) Parser Generators 3) Syntax – directed translation engines 4) Automatic Code Generators 5) Data Flow Engine
  • 54. Compiler Construction Tools Scanner generators: This tool takes regular expressions as input. For example LEX for Unix Operating System. Parser generators: A parser generator takes a grammar as input and automatically generates source code which can parse streams of characters with the help of a grammar Syntax-directed translation engines: These software tools offer an intermediate code by using the parse tree. It has a goal of associating one or more translations with each node of the parse tree. Automatic code generators: Takes intermediate code and converts them into Machine Language Data-flow engines: This tool is helpful for code optimization. Here, information is supplied by user and intermediate code is compared to analyze any relation. It is also known as data-flow analysis. It helps you to find out how values are transmitted from one part of the program to another part.
  • 55. Qualities of Compiler  Compiler itself must be bug free.  It must generate correct machine code.  Generated machine code must run fast (Execution speed).  Compilation time must be less.  Compilation must be portable.  It must be print good diagnostics and Error message.  Generated code must work well with existing debugger.  It must have consistent and Predictable optimization.
  • 56. References 1. Aho, Lam, Sethi, and Ullman, Compilers: Principles, Techniques andTools,SecondEdition, Pearson, 2014 2. D. M. Dhamdhere: Systerm Programming, Mc Graw Hill Publication 3. Dick Grune, Henri E. Bal, Jacob, Langendoen: Modern Compiler Design, Wiley India Publication
  • 57. MU Questions 1) Develop Analysis – Synthesis model of Compiler for a = b + c * 20. Write down explanation and output for each phase of compiler. 2) Difference between Compiler and Interpreter. 3) Explain Cousins of compiler. 4) Give the name of Front End and Back End with explanation, and take one example to show the output of the every phase.