SlideShare a Scribd company logo
1 of 31
The name compiler is primarily used for programs that translate source code
from a high-level programming language to a lower level language (e.g.,
assembly language, object code, or machine code) to create an executable
program.
It is computer software that transforms computer code written in one
programming language (the source language) into another programming
language (the target language).
Compilers are a type of translators that support digital devices, primarily
computers.
high-level languages is usually
r transpiler.
ogram that translates the form of
guage.
to tools used to create parsers that
un on a computer whose CPU or
om the one on which the compiler
mpiler.
n in the language that it intends to
m a low-level language to a higher
Program is free from lexical error
Program is free from semantics error
Program is free from syntax error
Even a complex program can be compiled in a small interval of time
In programs related to database accessing, many risks are reduced.
• In addition to the development of a compiler, the techniques used in
compiler design can be applicable to many problems in computer
science.
– Techniques used in a lexical analyzer can be used in text editors,
information retrieval system, and pattern recognition programs.
– Techniques used in a parser can be used in a query processing
system such as SQL.
– Many software having a complex front-end may need techniques
used in compiler design.
– Most of the techniques used in compiler design can be used in
Natural Language Processing (NLP) systems.
Major parts of a compiler:
Analysis:An intermediate representation is created from the source program.
Synthesis:The equivalent target program is created from this intermediate
representation.
• Each phase transforms the source program from one representation into
another representation.
• They communicate with error handlers.
• They communicate with the symbol table.
• Lexical Analyzer reads the source program character by character and
returns the tokens of the source program.
• A token describes a pattern of characters having same meaning in the
source program. (such as identifiers, operators, keywords, numbers and so
on)
• Puts information about identifiers into the symbol table.
Ex: newval := oldval + 12 => tokens:
newval
:=
oldval
+
12
identifier
assignment operator
identifier
add operator
a number
• Regular expressions are used to describe tokens (lexical
constructs).
• A (Deterministic) Finite State Automaton can be used in the
implementation of a lexical analyzer.
• A Syntax Analyzer creates the syntactic structure (generally a parse tree)
of the given program.
• A syntax analyzer is also called as a parser.
• A parse tree describes a syntactic structure.
• In a parse tree, all terminals are at leaves.
• All inner nodes are non-terminals in
a context free grammar.
• The syntax of a language is specified by a context free grammar (CFG).
• The rules in a CFG are mostly recursive.
• A syntax analyzer checks whether a given program satisfies the rules
implied by a CFG or not.
– If it satisfies, the syntax analyzer creates a parse tree for the given
program.
• Ex: We use BNF (Backus Naur Form) to specify a CFG
assignment -> identifier := expression
expression -> identifier
expression -> number
expression -> expression + expression
• A compiler may produce an explicit intermediate codes representing the
source program.
• These intermediate codes are generally machine .But the level of
intermediate codes is close to the level of machine codes.
• Ex: newval := oldval * fact + 1
id1 := id2 * id3 + 1
MULT id2,id3,temp1 Intermediates Codes (Quadraples)
ADD temp1,#1,temp2
MOV temp2,,id1
• The code optimizer optimizes the code produced by the intermediate code
generator in the terms of time and space.
• Ex:
MULT id2,id3,temp1
ADD temp1,#1,id1
Errors by compilation:
1.The compiler highlights all the possible errors which are obstacle in
the program to provide a good meaning.
2. Logical errors could be found only at runtime of the program.
Basic error in C:
Array bound missing
Array size too large
Bad file name
Call of on function
Declaration missing
Compound statement missing
Illegal accessions
http://judge.uaizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C
Rectangle
Write a programwhich calculates the area and perimeter of a given
rectangle.
Input:
The length a and breadth b of the rectangle are given in a line separated by a
single space.
Output:
Print the area and perimeter of the rectangle in a line.
The two integers should be separated by a single space.
Constraints:
1 ≤ a, b ≤ 100
Source code:
#include <stdio.h>
int main ()
{
int a,b,perimeter,area;
scanf ("%d %d",&a,&b);
perimeter=2*(a+b);
area=a*b;
printf ("%d %dn",area,perimeter);
}
Discussion:
The source code is correct, therefore there is no error after
we compile.
https://www.urionlinejudge.com.br/judge/en/problems/view/1036
Read 3 floating-point numbers. After, print the roots of
bhaskara’s formula. If it's impossible to calculate the roots because
a division by zero or a square root of a negative number, presents
the message “Impossivel calcular”.
Input:
Read 3 floating-point numbers A, B and C.
Output:
Print the result with 5 digits after the decimal point or the
message if it is impossible to calculate.
Sourcecode:
#include <stdio.h>
#include <math.h>
int main() {
float B,C,p,q,r;
scanf ("%f %f %f",&A,&B,&C);
p=(B*B)-(4*A*C);
if (p<0)
printf ("Impossivel calcularn");
else if (A == 0)
printf ("Impossivel calcularn");
else {
q=(-B+sqrt(p))/(A+A);
r=(-B-sqrt(p))/(A+A);
printf ("R1 = %.5fn",q);
printf ("R2 = %.5fn",r);
}
return 0;
}
DISCUSSION:
AS WE DIDN’T DECLARE AN IDENTIFIER A , THE
COMPILER IS SHOWING THAT THERE IS AN ERROR IN
THE 5TH LINE.
 http://pintokarsanda.blog.binusian.org/files/2014/03/front-and-back-end-compilers.png
 https://en.wikipedia.org/wiki/Compiler
 https://en.wikipedia.org/wiki/Preprocessor
 https://en.wikipedia.org/wiki/Lexical_analysis
 https://en.wikipedia.org/wiki/Parsing
 https://en.wikipedia.org/wiki/Semantic_analysis_(compilers)
 https://en.wikipedia.org/wiki/Intermediate_representation
 https://en.wikipedia.org/wiki/Program_optimization
 https://www.google.com/search?source=hp&ei=ZrDZWt6CKMrbvAT5nZegDg&q=co
mpiler+front+end+back+end&oq=compiler+front+end+back+end&gs_l=psy-
ab.3..0j0i22i10i30k1l2.5110134.5119852.0.5121674.34.26.0.0.0.0.1800.1800.8-
1.1.0....0...1c.1.64.psy-ab..33.1.1798.0...0.HSNGp7V62Zw
Presentation1

More Related Content

What's hot

Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Bhavin Darji
 
Compiler Construction Course - Introduction
Compiler Construction Course - IntroductionCompiler Construction Course - Introduction
Compiler Construction Course - IntroductionMuhammad Sanaullah
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler ConstructionSarmad Ali
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler ConstructionAhmed Raza
 
Cs6660 compiler design
Cs6660 compiler designCs6660 compiler design
Cs6660 compiler designhari2010
 
Error detection recovery
Error detection recoveryError detection recovery
Error detection recoveryTech_MX
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language ProcessingHemant Sharma
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction toolsAkhil Kaushik
 
Introduction to course
Introduction to courseIntroduction to course
Introduction to coursenikit meshram
 
Compiler Design Lecture Notes
Compiler Design Lecture NotesCompiler Design Lecture Notes
Compiler Design Lecture NotesFellowBuddy.com
 

What's hot (20)

Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
 
Compiler Construction Course - Introduction
Compiler Construction Course - IntroductionCompiler Construction Course - Introduction
Compiler Construction Course - Introduction
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Compiler1
Compiler1Compiler1
Compiler1
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
Compiler construction
Compiler constructionCompiler construction
Compiler construction
 
Cs6660 compiler design
Cs6660 compiler designCs6660 compiler design
Cs6660 compiler design
 
Error detection recovery
Error detection recoveryError detection recovery
Error detection recovery
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
 
Ch1
Ch1Ch1
Ch1
 
Cpcs302 1
Cpcs302  1Cpcs302  1
Cpcs302 1
 
Introduction to course
Introduction to courseIntroduction to course
Introduction to course
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Compiler Design Lecture Notes
Compiler Design Lecture NotesCompiler Design Lecture Notes
Compiler Design Lecture Notes
 

Similar to Presentation1

Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overviewamudha arul
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptxPmarkNorcio
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in detailskazi_aihtesham
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptxssuser3b4934
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdfAkarTaher
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfDrIsikoIsaac
 
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
 
1.Overview of Programming.pptx
1.Overview of Programming.pptx1.Overview of Programming.pptx
1.Overview of Programming.pptxVishwas459764
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction Thapar Institute
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction Sarmad Ali
 
Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02Tirumala Rao
 
lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdfwigewej294
 
week 2 - INTRO TO PROGRAMMING.pptx
week 2 - INTRO TO PROGRAMMING.pptxweek 2 - INTRO TO PROGRAMMING.pptx
week 2 - INTRO TO PROGRAMMING.pptxnuruddinnnaim
 
Code generation errors and recovery
Code generation errors and recoveryCode generation errors and recovery
Code generation errors and recoveryMomina Idrees
 

Similar to Presentation1 (20)

Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overview
 
COMPILER DESIGN PPTS.pptx
COMPILER DESIGN PPTS.pptxCOMPILER DESIGN PPTS.pptx
COMPILER DESIGN PPTS.pptx
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
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.pdf
 
1.Overview of Programming.pptx
1.Overview of Programming.pptx1.Overview of Programming.pptx
1.Overview of Programming.pptx
 
1 cc
1 cc1 cc
1 cc
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction
 
Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02
 
lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdf
 
week 2 - INTRO TO PROGRAMMING.pptx
week 2 - INTRO TO PROGRAMMING.pptxweek 2 - INTRO TO PROGRAMMING.pptx
week 2 - INTRO TO PROGRAMMING.pptx
 
1._Introduction_.pptx
1._Introduction_.pptx1._Introduction_.pptx
1._Introduction_.pptx
 
Code generation errors and recovery
Code generation errors and recoveryCode generation errors and recovery
Code generation errors and recovery
 

Recently uploaded

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 

Recently uploaded (20)

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 

Presentation1

  • 1.
  • 2. The name compiler is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language, object code, or machine code) to create an executable program. It is computer software that transforms computer code written in one programming language (the source language) into another programming language (the target language). Compilers are a type of translators that support digital devices, primarily computers.
  • 3.
  • 4. high-level languages is usually r transpiler. ogram that translates the form of guage. to tools used to create parsers that un on a computer whose CPU or om the one on which the compiler mpiler. n in the language that it intends to m a low-level language to a higher
  • 5. Program is free from lexical error Program is free from semantics error Program is free from syntax error Even a complex program can be compiled in a small interval of time In programs related to database accessing, many risks are reduced.
  • 6. • In addition to the development of a compiler, the techniques used in compiler design can be applicable to many problems in computer science. – Techniques used in a lexical analyzer can be used in text editors, information retrieval system, and pattern recognition programs. – Techniques used in a parser can be used in a query processing system such as SQL.
  • 7. – Many software having a complex front-end may need techniques used in compiler design. – Most of the techniques used in compiler design can be used in Natural Language Processing (NLP) systems.
  • 8. Major parts of a compiler: Analysis:An intermediate representation is created from the source program. Synthesis:The equivalent target program is created from this intermediate representation. • Each phase transforms the source program from one representation into another representation. • They communicate with error handlers. • They communicate with the symbol table.
  • 9.
  • 10. • Lexical Analyzer reads the source program character by character and returns the tokens of the source program. • A token describes a pattern of characters having same meaning in the source program. (such as identifiers, operators, keywords, numbers and so on) • Puts information about identifiers into the symbol table.
  • 11. Ex: newval := oldval + 12 => tokens: newval := oldval + 12 identifier assignment operator identifier add operator a number • Regular expressions are used to describe tokens (lexical constructs). • A (Deterministic) Finite State Automaton can be used in the implementation of a lexical analyzer.
  • 12. • A Syntax Analyzer creates the syntactic structure (generally a parse tree) of the given program. • A syntax analyzer is also called as a parser. • A parse tree describes a syntactic structure. • In a parse tree, all terminals are at leaves. • All inner nodes are non-terminals in a context free grammar.
  • 13. • The syntax of a language is specified by a context free grammar (CFG). • The rules in a CFG are mostly recursive. • A syntax analyzer checks whether a given program satisfies the rules implied by a CFG or not. – If it satisfies, the syntax analyzer creates a parse tree for the given program.
  • 14. • Ex: We use BNF (Backus Naur Form) to specify a CFG assignment -> identifier := expression expression -> identifier expression -> number expression -> expression + expression
  • 15.
  • 16. • A compiler may produce an explicit intermediate codes representing the source program. • These intermediate codes are generally machine .But the level of intermediate codes is close to the level of machine codes. • Ex: newval := oldval * fact + 1 id1 := id2 * id3 + 1 MULT id2,id3,temp1 Intermediates Codes (Quadraples) ADD temp1,#1,temp2 MOV temp2,,id1
  • 17. • The code optimizer optimizes the code produced by the intermediate code generator in the terms of time and space. • Ex: MULT id2,id3,temp1 ADD temp1,#1,id1
  • 18.
  • 19.
  • 20. Errors by compilation: 1.The compiler highlights all the possible errors which are obstacle in the program to provide a good meaning. 2. Logical errors could be found only at runtime of the program.
  • 21. Basic error in C: Array bound missing Array size too large Bad file name Call of on function Declaration missing Compound statement missing Illegal accessions
  • 22. http://judge.uaizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C Rectangle Write a programwhich calculates the area and perimeter of a given rectangle. Input: The length a and breadth b of the rectangle are given in a line separated by a single space.
  • 23. Output: Print the area and perimeter of the rectangle in a line. The two integers should be separated by a single space. Constraints: 1 ≤ a, b ≤ 100
  • 24. Source code: #include <stdio.h> int main () { int a,b,perimeter,area; scanf ("%d %d",&a,&b); perimeter=2*(a+b); area=a*b; printf ("%d %dn",area,perimeter); }
  • 25. Discussion: The source code is correct, therefore there is no error after we compile.
  • 26. https://www.urionlinejudge.com.br/judge/en/problems/view/1036 Read 3 floating-point numbers. After, print the roots of bhaskara’s formula. If it's impossible to calculate the roots because a division by zero or a square root of a negative number, presents the message “Impossivel calcular”. Input: Read 3 floating-point numbers A, B and C.
  • 27. Output: Print the result with 5 digits after the decimal point or the message if it is impossible to calculate.
  • 28. Sourcecode: #include <stdio.h> #include <math.h> int main() { float B,C,p,q,r; scanf ("%f %f %f",&A,&B,&C); p=(B*B)-(4*A*C); if (p<0) printf ("Impossivel calcularn"); else if (A == 0) printf ("Impossivel calcularn"); else { q=(-B+sqrt(p))/(A+A); r=(-B-sqrt(p))/(A+A); printf ("R1 = %.5fn",q); printf ("R2 = %.5fn",r); } return 0; }
  • 29. DISCUSSION: AS WE DIDN’T DECLARE AN IDENTIFIER A , THE COMPILER IS SHOWING THAT THERE IS AN ERROR IN THE 5TH LINE.
  • 30.  http://pintokarsanda.blog.binusian.org/files/2014/03/front-and-back-end-compilers.png  https://en.wikipedia.org/wiki/Compiler  https://en.wikipedia.org/wiki/Preprocessor  https://en.wikipedia.org/wiki/Lexical_analysis  https://en.wikipedia.org/wiki/Parsing  https://en.wikipedia.org/wiki/Semantic_analysis_(compilers)  https://en.wikipedia.org/wiki/Intermediate_representation  https://en.wikipedia.org/wiki/Program_optimization  https://www.google.com/search?source=hp&ei=ZrDZWt6CKMrbvAT5nZegDg&q=co mpiler+front+end+back+end&oq=compiler+front+end+back+end&gs_l=psy- ab.3..0j0i22i10i30k1l2.5110134.5119852.0.5121674.34.26.0.0.0.0.1800.1800.8- 1.1.0....0...1c.1.64.psy-ab..33.1.1798.0...0.HSNGp7V62Zw