SlideShare a Scribd company logo
Programming Language
• Notations describing computational concepts
• It is a software running on computer
• It requires translation to run on computers
• This translation is done by the compilers
• Compiler is the main software under language processor
INTRODUCTION TO COMPILER
• Supporting/Interlinked software to do translation process is Language Processor
• It is a software program that helps for the translation of the source code to the
machine code
Types of Language Processor
Compiler
• Converts complete source program to object program
Interpreter
• Converts source program to object program line by line
Assembler
• Converts source program in assembly level instructions to object code
LANGUAGE PROCESSOR
COMPILER
• Compiler is a software/program that read the program in one language called source code and
translates it into an object code
Characteristics
• Converts entire source program at a time
• Detects all syntax errors at a time
• Requires huge memory space for processing
• Executes very fast
INTERPRETER
• Interpreter is a software that translates the source program in HLL to object code(machine level language) line
by line
Characteristics
• It is the simplest form of translation
• Line by Line translation
• Detects only one error at a time
• Requires less memory space
• Slow in execution
ASSEMBLER
• Assembler is a software that converts low level/assembly language to machine code
• The object code is meant for specific hardware only, not easily transferable from one file to
another file
Characteristics
• Instructions will be in mnemonics codes
• Produces object code as output
• Object code is hardware specific
ASSEMBLER COMPILER
1. Translates source code in assembly language to
machine language
Translates source code in High level language to
machine language
2. Slow execution 2. Executes very fast
3. Less sophisticated program 3. More sophisticated program
4. Instructions will be in mnemonic codes 4. High level programming instructions
5. The object code need to be linked to run on a
machine
5. Compilers produce machine executable code
directly from HLL
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
Compiler Design
Compiler Design
Compiler Design
Compiler design
Context free grammar
Context free grammar
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
CD module 1.pptx Introduction to compiler Design
Lexical Analyzer
Lexical Analyzer
Lexical Analyzer
Lexical Analyzer
Lexical Analyzer
Lexical Analyzer
Lexical Analyzer
Lexical Analyzer
Compiler Passes
• One-pass Compiler
If we combine or group all the phases of compiler
design in a single module known as a single pass
compiler.
•One-pass compiler is used to traverse the program
only once. The one-pass compiler passes only once
through the parts of each compilation unit. It
translates each part into its final machine code.
• In the one pass compiler, when the line source is
processed, it is scanned and the token is extracted.
• Then the syntax of each line is analyzed and the tree
structure is build. After the semantic part, the code is
generated.
•The same process is repeated for each line of code
Pass is a complete traversal of the source program. Compiler has two passes to traverse the
source program.
Compiler Passes
Multi-pass Compiler
• Multi pass compiler is used to process the source code of a program several times.
• In the first pass, compiler can read the source program, scan it, extract the tokens
and store the result in an output file.
• In the second pass, compiler can read the output file produced by first pass, build the
syntactic tree and perform the syntactical analysis. The output of this phase is a file
that contains the syntactical tree.
• In the third pass, compiler can read the output file produced by second pass and
check that the tree follows the rules of language or not. The output of semantic
analysis phase is the annotated tree syntax.
• This pass is going on, until the target output is produced.
One-pass Compiler
One-Pass Compiler Multi-Pass Compiler
It reads the code only once and translates it at a
similar time.
It reads the code multiple times, each time changing it
into numerous forms.
They are faster. They are "slower." As more number of passes means
more execution time.
Less efficient code optimization and code generation. Better code optimization and code generation.
It is also called a "Narrow compiler." It has limited
scope.
It is also called a "wide compiler." As they can scan
every portion of the program.
The compiler requires large memory. The memory occupied by one pass can be reused by a
subsequent pass; therefore, small memory is needed
by the compiler.
Example − Pascal & C languages use one-pass
compilation.
Example − Modula -2 languages use multi-pass
compilation.
One-pass Compiler
One pass Two-pass
It performs Translation in one pass It performs Translation in two pass
It scans the entire file only once. It requires two passes to scan the source file.
It generates Intermediate code It does not generate Intermediate code
It is faster than two pass assembler It is slower than two pass assembler
A loader is not required A loader is required.
No object program is written. A loader is required as the object code is generated.
Perform some professing of assembler directives. Perform processing of assembler directives not done in
pass-1
The data structure used are:
The symbol table, literal table, pool table, and table of
incomplete.
The data structure used are:
The symbol table, literal table, and pool table.
These assemblers perform the whole conversion of
assembly code to machine code in one go.
These assemblers first process the assembly code and
store values in the opcode table and symbol table and
then in the second step they generate the machine code
using these tables.

More Related Content

PPTX
Compiler Design Introduction
PPT
Introduction to compiler design and phases of compiler
PPTX
Introduction to Compilers
PPTX
Passes of Compiler.pptx
PPT
Compiler Design Basics
PPTX
COMPILER DESIGN PPTS.pptx
PPTX
4_5802928814682016556.pptx
PPTX
CD - CH1 - Introduction to compiler design.pptx
Compiler Design Introduction
Introduction to compiler design and phases of compiler
Introduction to Compilers
Passes of Compiler.pptx
Compiler Design Basics
COMPILER DESIGN PPTS.pptx
4_5802928814682016556.pptx
CD - CH1 - Introduction to compiler design.pptx

Similar to CD module 1.pptx Introduction to compiler Design (20)

PPTX
Cd ch1 - introduction
PPTX
Compiler Construction from very basic start
PPT
Compiler Design Basics
PPTX
Compiler Design Introduction With Design
PPTX
Compiler constuction lec 1 ( features of compiler and types of compiler).pptx
PPTX
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
PPTX
Pros and cons of c as a compiler language
PPTX
Phases of Compiler.pptx
PPTX
Lec 1 Compiler Construction (CC) CC.pptx
PPTX
Chapter 1.pptx
PPTX
Life cycle of a computer program
PPTX
System software module 1 presentation file
PPTX
Phases of Compiler
PPTX
aditya malkani compiler.pptx
PPT
Introduction to compiler
PDF
Chapter1pdf__2021_11_23_10_53_20.pdf
PPTX
single pass compiler and its architecture
PDF
Compilerandinterpreterghhhjjjjjjjjnnn.pdf
PPTX
Unit 1 part1 Introduction of Compiler Design.pptx
DOC
Cd ch1 - introduction
Compiler Construction from very basic start
Compiler Design Basics
Compiler Design Introduction With Design
Compiler constuction lec 1 ( features of compiler and types of compiler).pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
Pros and cons of c as a compiler language
Phases of Compiler.pptx
Lec 1 Compiler Construction (CC) CC.pptx
Chapter 1.pptx
Life cycle of a computer program
System software module 1 presentation file
Phases of Compiler
aditya malkani compiler.pptx
Introduction to compiler
Chapter1pdf__2021_11_23_10_53_20.pdf
single pass compiler and its architecture
Compilerandinterpreterghhhjjjjjjjjnnn.pdf
Unit 1 part1 Introduction of Compiler Design.pptx
Ad

Recently uploaded (20)

PPTX
YV PROFILE PROJECTS PROFILE PRES. DESIGN
PPTX
Complete Guide to Microsoft PowerPoint 2019 – Features, Tools, and Tips"
PPTX
ANATOMY OF ANTERIOR CHAMBER ANGLE AND GONIOSCOPY.pptx
PDF
Phone away, tabs closed: No multitasking
PPTX
Media And Information Literacy for Grade 12
DOCX
The story of the first moon landing.docx
PPT
UNIT I- Yarn, types, explanation, process
PPT
Machine printing techniques and plangi dyeing
PPTX
mahatma gandhi bus terminal in india Case Study.pptx
PDF
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
PDF
Urban Design Final Project-Site Analysis
PDF
Quality Control Management for RMG, Level- 4, Certificate
PPTX
areprosthodontics and orthodonticsa text.pptx
PPTX
AD Bungalow Case studies Sem 2.pptxvwewev
PPTX
joggers park landscape assignment bandra
PPTX
Entrepreneur intro, origin, process, method
PPTX
An introduction to AI in research and reference management
PDF
SEVA- Fashion designing-Presentation.pdf
PDF
Emailing DDDX-MBCaEiB.pdf DDD_Europe_2022_Intro_to_Context_Mapping_pdf-165590...
PPTX
HPE Aruba-master-icon-library_052722.pptx
YV PROFILE PROJECTS PROFILE PRES. DESIGN
Complete Guide to Microsoft PowerPoint 2019 – Features, Tools, and Tips"
ANATOMY OF ANTERIOR CHAMBER ANGLE AND GONIOSCOPY.pptx
Phone away, tabs closed: No multitasking
Media And Information Literacy for Grade 12
The story of the first moon landing.docx
UNIT I- Yarn, types, explanation, process
Machine printing techniques and plangi dyeing
mahatma gandhi bus terminal in india Case Study.pptx
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
Urban Design Final Project-Site Analysis
Quality Control Management for RMG, Level- 4, Certificate
areprosthodontics and orthodonticsa text.pptx
AD Bungalow Case studies Sem 2.pptxvwewev
joggers park landscape assignment bandra
Entrepreneur intro, origin, process, method
An introduction to AI in research and reference management
SEVA- Fashion designing-Presentation.pdf
Emailing DDDX-MBCaEiB.pdf DDD_Europe_2022_Intro_to_Context_Mapping_pdf-165590...
HPE Aruba-master-icon-library_052722.pptx
Ad

CD module 1.pptx Introduction to compiler Design

  • 1. Programming Language • Notations describing computational concepts • It is a software running on computer • It requires translation to run on computers • This translation is done by the compilers • Compiler is the main software under language processor INTRODUCTION TO COMPILER
  • 2. • Supporting/Interlinked software to do translation process is Language Processor • It is a software program that helps for the translation of the source code to the machine code Types of Language Processor Compiler • Converts complete source program to object program Interpreter • Converts source program to object program line by line Assembler • Converts source program in assembly level instructions to object code LANGUAGE PROCESSOR
  • 3. COMPILER • Compiler is a software/program that read the program in one language called source code and translates it into an object code Characteristics • Converts entire source program at a time • Detects all syntax errors at a time • Requires huge memory space for processing • Executes very fast INTERPRETER • Interpreter is a software that translates the source program in HLL to object code(machine level language) line by line Characteristics • It is the simplest form of translation • Line by Line translation • Detects only one error at a time • Requires less memory space • Slow in execution
  • 4. ASSEMBLER • Assembler is a software that converts low level/assembly language to machine code • The object code is meant for specific hardware only, not easily transferable from one file to another file Characteristics • Instructions will be in mnemonics codes • Produces object code as output • Object code is hardware specific
  • 5. ASSEMBLER COMPILER 1. Translates source code in assembly language to machine language Translates source code in High level language to machine language 2. Slow execution 2. Executes very fast 3. Less sophisticated program 3. More sophisticated program 4. Instructions will be in mnemonic codes 4. High level programming instructions 5. The object code need to be linked to run on a machine 5. Compilers produce machine executable code directly from HLL
  • 36. Compiler Passes • One-pass Compiler If we combine or group all the phases of compiler design in a single module known as a single pass compiler. •One-pass compiler is used to traverse the program only once. The one-pass compiler passes only once through the parts of each compilation unit. It translates each part into its final machine code. • In the one pass compiler, when the line source is processed, it is scanned and the token is extracted. • Then the syntax of each line is analyzed and the tree structure is build. After the semantic part, the code is generated. •The same process is repeated for each line of code Pass is a complete traversal of the source program. Compiler has two passes to traverse the source program.
  • 37. Compiler Passes Multi-pass Compiler • Multi pass compiler is used to process the source code of a program several times. • In the first pass, compiler can read the source program, scan it, extract the tokens and store the result in an output file. • In the second pass, compiler can read the output file produced by first pass, build the syntactic tree and perform the syntactical analysis. The output of this phase is a file that contains the syntactical tree. • In the third pass, compiler can read the output file produced by second pass and check that the tree follows the rules of language or not. The output of semantic analysis phase is the annotated tree syntax. • This pass is going on, until the target output is produced.
  • 39. One-Pass Compiler Multi-Pass Compiler It reads the code only once and translates it at a similar time. It reads the code multiple times, each time changing it into numerous forms. They are faster. They are "slower." As more number of passes means more execution time. Less efficient code optimization and code generation. Better code optimization and code generation. It is also called a "Narrow compiler." It has limited scope. It is also called a "wide compiler." As they can scan every portion of the program. The compiler requires large memory. The memory occupied by one pass can be reused by a subsequent pass; therefore, small memory is needed by the compiler. Example − Pascal & C languages use one-pass compilation. Example − Modula -2 languages use multi-pass compilation.
  • 40. One-pass Compiler One pass Two-pass It performs Translation in one pass It performs Translation in two pass It scans the entire file only once. It requires two passes to scan the source file. It generates Intermediate code It does not generate Intermediate code It is faster than two pass assembler It is slower than two pass assembler A loader is not required A loader is required. No object program is written. A loader is required as the object code is generated. Perform some professing of assembler directives. Perform processing of assembler directives not done in pass-1 The data structure used are: The symbol table, literal table, pool table, and table of incomplete. The data structure used are: The symbol table, literal table, and pool table. These assemblers perform the whole conversion of assembly code to machine code in one go. These assemblers first process the assembly code and store values in the opcode table and symbol table and then in the second step they generate the machine code using these tables.