SlideShare a Scribd company logo
1 of 14
Parser
DEFINITION AND SOME KEY POINTS
Definition
 A computer program use just to evaluate scripts according
  to the respective grammar.

 In computer Science, its a text analyzing process to
  determine if it belongs to a certain language or not.


 Mostly used as a part of High-Level-Language
  translators(Interpreter or Compiler).


 But some Standalone Parsers are available for specific
  purposes.(for e.g. http://nlp.stanford.edu/software/lex-parser.shtml)
What and How it works?

 It first receives input in the form of
    sequential source program or
    Stream of characters (String).
 Break them into small chunks or parts (tokens).
   For Example in English Language:


             He is running to school
             Subject    Verb           Object


 And produces a data-structure that is usually a tree.
What is not Parsing?

 Parser does not evaluate one thing into another. If
 just change its representation from one form to
 another.

 Parser is not responsible for summarizing or extract
 the original body of text.

Word Processing Programs also uses a parser to check
spelling and grammatical mistakes.
But What is Compiler ???

    Compiler is a Language Translator or a
  computer program that translates a Human
   understandable instruction set into Computer
               understandable form

  Or simply, the output of compiler is .exe file,

Object code or RTL(Register Transfer Language)
Compiler VS Parser

 From the previous discussion it can be concluded
 that:
    The output of Parser is a Data-Structure that is useless for the
     for both Liveware and hardware.
        But this will be a very useful input for some component of the
         compiler.


    Whereas, the output of the compiler is understandable and can
     be executed by Computer hardware
Phases of Compiler
Phases of Compiler

              These 3 phases can
              be called as they
              are actually
              parsing the source
              Program
Lexical Analysis

 As the name shows, Its done by Lexical Analyzer.


 Reads the characters from the input stream or source
  program.
 Group them in tokens.
 Each token describe some important element.


 CONFUSED….!!!
 Lets see an exmaple.
Token Example

 int a = 10 ;
 That’s the code for declaring and initializing a variable “a”.
 When this LOC passed through t Lexical Box following
  thing happens
                             Identifier Constant

                        int a = 10 ;
                     Data Type Assignment Symbol
                                Operator

 Each of this term is called as Token.
 For e.g. “a” is a token of “Identifier type”.
 The Character Sequence “int” is called as the its Lexeme.
           http://en.wikipedia.org/wiki/Token_(parser)#Token
Can we proceed further OR
Syntax Analyzer

 According to many sources, this phase is actually
 responsible for Parsing.
 So, the input of this phase is the Tokens formed in
 the previous phase i.e. Lexical Analysis.
 In this phase, the recently formed token acquire a
 Hierarchical Data Structure, that’s called Tree in
 Computer Science.
Before Moving Further

 First Explore this New Buzz Word Tree.

 Definition: Its an hierarchical Data Structure that is

 also known as the Collection of some related nodes.
Terminologies

 Node is structure that contains some value or
 condition.

 In the tree on right side
 “2” is a parent node that has two
  child nodes “7” and “5”.

More Related Content

What's hot

Compiler_Project_Srikanth_Vanama
Compiler_Project_Srikanth_VanamaCompiler_Project_Srikanth_Vanama
Compiler_Project_Srikanth_Vanama
Srikanth Vanama
 
Principles of compiler design
Principles of compiler designPrinciples of compiler design
Principles of compiler design
Janani Parthiban
 

What's hot (20)

Cd ch2 - lexical analysis
Cd   ch2 - lexical analysisCd   ch2 - lexical analysis
Cd ch2 - lexical analysis
 
Compiler construction
Compiler constructionCompiler construction
Compiler construction
 
Java chapter 3
Java   chapter 3Java   chapter 3
Java chapter 3
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Declarative programming language
Declarative programming languageDeclarative programming language
Declarative programming language
 
1 compiler outline
1 compiler outline1 compiler outline
1 compiler outline
 
Using Static Analysis in Program Development
Using Static Analysis in Program DevelopmentUsing Static Analysis in Program Development
Using Static Analysis in Program Development
 
Lexical1
Lexical1Lexical1
Lexical1
 
Relationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & PatternRelationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & Pattern
 
Compilers in computer programming
Compilers in computer programmingCompilers in computer programming
Compilers in computer programming
 
Flex (fast lexical analyzer generator )
Flex (fast lexical analyzer generator )Flex (fast lexical analyzer generator )
Flex (fast lexical analyzer generator )
 
Assignment4
Assignment4Assignment4
Assignment4
 
Compiler_Project_Srikanth_Vanama
Compiler_Project_Srikanth_VanamaCompiler_Project_Srikanth_Vanama
Compiler_Project_Srikanth_Vanama
 
Hema wt (1)
Hema wt (1)Hema wt (1)
Hema wt (1)
 
Principles of compiler design
Principles of compiler designPrinciples of compiler design
Principles of compiler design
 
Syntax
SyntaxSyntax
Syntax
 
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 1)
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 1)Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 1)
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 1)
 
Syntax analyzer
Syntax analyzerSyntax analyzer
Syntax analyzer
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Language processors
Language processorsLanguage processors
Language processors
 

Similar to Parser

Data design and analysis of computing tools
Data design and analysis of computing toolsData design and analysis of computing tools
Data design and analysis of computing tools
KamranAli649587
 
automata theroy and compiler designc.pptx
automata theroy and compiler designc.pptxautomata theroy and compiler designc.pptx
automata theroy and compiler designc.pptx
YashaswiniYashu9555
 

Similar to Parser (20)

compiler introduction vtu syllabus 1st chapter.pptx
compiler introduction vtu syllabus 1st chapter.pptxcompiler introduction vtu syllabus 1st chapter.pptx
compiler introduction vtu syllabus 1st chapter.pptx
 
A Role of Lexical Analyzer
A Role of Lexical AnalyzerA Role of Lexical Analyzer
A Role of Lexical Analyzer
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Pcd question bank
Pcd question bank Pcd question bank
Pcd question bank
 
11700220036.pdf
11700220036.pdf11700220036.pdf
11700220036.pdf
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Data design and analysis of computing tools
Data design and analysis of computing toolsData design and analysis of computing tools
Data design and analysis of computing tools
 
automata theroy and compiler designc.pptx
automata theroy and compiler designc.pptxautomata theroy and compiler designc.pptx
automata theroy and compiler designc.pptx
 
Language for specifying lexical Analyzer
Language for specifying lexical AnalyzerLanguage for specifying lexical Analyzer
Language for specifying lexical Analyzer
 
1._Introduction_.pptx
1._Introduction_.pptx1._Introduction_.pptx
1._Introduction_.pptx
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptx
 
COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis: COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis:
 
Structure of the compiler
Structure of the compilerStructure of the compiler
Structure of the compiler
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATORPSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
Parsing
ParsingParsing
Parsing
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
Ss ui lecture 2
Ss ui lecture 2Ss ui lecture 2
Ss ui lecture 2
 
COMPILER DESIGN.pdf
COMPILER DESIGN.pdfCOMPILER DESIGN.pdf
COMPILER DESIGN.pdf
 

Recently uploaded

Recently uploaded (20)

Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 

Parser

  • 2. Definition  A computer program use just to evaluate scripts according to the respective grammar.  In computer Science, its a text analyzing process to determine if it belongs to a certain language or not.  Mostly used as a part of High-Level-Language translators(Interpreter or Compiler).  But some Standalone Parsers are available for specific purposes.(for e.g. http://nlp.stanford.edu/software/lex-parser.shtml)
  • 3. What and How it works?  It first receives input in the form of  sequential source program or  Stream of characters (String).  Break them into small chunks or parts (tokens).  For Example in English Language: He is running to school Subject Verb Object  And produces a data-structure that is usually a tree.
  • 4. What is not Parsing?  Parser does not evaluate one thing into another. If just change its representation from one form to another.  Parser is not responsible for summarizing or extract the original body of text. Word Processing Programs also uses a parser to check spelling and grammatical mistakes.
  • 5. But What is Compiler ??? Compiler is a Language Translator or a computer program that translates a Human understandable instruction set into Computer understandable form Or simply, the output of compiler is .exe file, Object code or RTL(Register Transfer Language)
  • 6. Compiler VS Parser  From the previous discussion it can be concluded that:  The output of Parser is a Data-Structure that is useless for the for both Liveware and hardware.  But this will be a very useful input for some component of the compiler.  Whereas, the output of the compiler is understandable and can be executed by Computer hardware
  • 8. Phases of Compiler These 3 phases can be called as they are actually parsing the source Program
  • 9. Lexical Analysis  As the name shows, Its done by Lexical Analyzer.  Reads the characters from the input stream or source program.  Group them in tokens.  Each token describe some important element.  CONFUSED….!!!  Lets see an exmaple.
  • 10. Token Example  int a = 10 ;  That’s the code for declaring and initializing a variable “a”.  When this LOC passed through t Lexical Box following thing happens Identifier Constant int a = 10 ; Data Type Assignment Symbol Operator  Each of this term is called as Token.  For e.g. “a” is a token of “Identifier type”.  The Character Sequence “int” is called as the its Lexeme. http://en.wikipedia.org/wiki/Token_(parser)#Token
  • 11. Can we proceed further OR
  • 12. Syntax Analyzer  According to many sources, this phase is actually responsible for Parsing.  So, the input of this phase is the Tokens formed in the previous phase i.e. Lexical Analysis.  In this phase, the recently formed token acquire a Hierarchical Data Structure, that’s called Tree in Computer Science.
  • 13. Before Moving Further  First Explore this New Buzz Word Tree.  Definition: Its an hierarchical Data Structure that is also known as the Collection of some related nodes.
  • 14. Terminologies  Node is structure that contains some value or condition.  In the tree on right side  “2” is a parent node that has two child nodes “7” and “5”.