SlideShare a Scribd company logo
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

PPT
Lexical Analyzers and Parsers
PDF
Token, Pattern and Lexeme
PPTX
role of lexical anaysis
PDF
PPTX
Lexical analyzer
PPT
Syntax analysis
TXT
tokens patterns and lexemes
Lexical Analyzers and Parsers
Token, Pattern and Lexeme
role of lexical anaysis
Lexical analyzer
Syntax analysis
tokens patterns and lexemes

What's hot (20)

PPTX
Cd ch2 - lexical analysis
PPTX
Compiler construction
PDF
Java chapter 3
PPT
Syntax analysis
PPT
Declarative programming language
PPTX
1 compiler outline
PDF
Using Static Analysis in Program Development
PPT
PPTX
Relationship Among Token, Lexeme & Pattern
PPTX
Compilers in computer programming
PPTX
Flex (fast lexical analyzer generator )
PDF
Assignment4
PPT
Compiler_Project_Srikanth_Vanama
PPTX
Hema wt (1)
PPT
Principles of compiler design
PPTX
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 1)
PPTX
Syntax analyzer
PPTX
Fundamentals of Language Processing
PDF
Language processors
Cd ch2 - lexical analysis
Compiler construction
Java chapter 3
Syntax analysis
Declarative programming language
1 compiler outline
Using Static Analysis in Program Development
Relationship Among Token, Lexeme & Pattern
Compilers in computer programming
Flex (fast lexical analyzer generator )
Assignment4
Compiler_Project_Srikanth_Vanama
Hema wt (1)
Principles of compiler design
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 1)
Syntax analyzer
Fundamentals of Language Processing
Language processors
Ad

Similar to Parser (20)

PPTX
compiler introduction vtu syllabus 1st chapter.pptx
PPTX
Chapter 2.pptx compiler design lecture note
PPTX
A Role of Lexical Analyzer
DOCX
Compiler Design
DOC
Pcd question bank
PDF
11700220036.pdf
PPT
Lexical analyzer
PPT
Data design and analysis of computing tools
PPTX
automata theroy and compiler designc.pptx
PPTX
Language for specifying lexical Analyzer
PPTX
1._Introduction_.pptx
PPT
Chapter-2-lexical-analyser and its property lecture note.ppt
PPTX
COMPILER CONSTRUCTION KU 1.pptx
PDF
compiler.pdfljdvgepitju4io3elkhldhyreyio4uw
PDF
COMPILER DESIGN- Introduction & Lexical Analysis:
PPTX
Structure of the compiler
PPT
Lexical Analysis
PDF
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
PPT
1.Role lexical Analyzer
PDF
role of lexical parser compiler design1-181124035217.pdf
compiler introduction vtu syllabus 1st chapter.pptx
Chapter 2.pptx compiler design lecture note
A Role of Lexical Analyzer
Compiler Design
Pcd question bank
11700220036.pdf
Lexical analyzer
Data design and analysis of computing tools
automata theroy and compiler designc.pptx
Language for specifying lexical Analyzer
1._Introduction_.pptx
Chapter-2-lexical-analyser and its property lecture note.ppt
COMPILER CONSTRUCTION KU 1.pptx
compiler.pdfljdvgepitju4io3elkhldhyreyio4uw
COMPILER DESIGN- Introduction & Lexical Analysis:
Structure of the compiler
Lexical Analysis
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
1.Role lexical Analyzer
role of lexical parser compiler design1-181124035217.pdf
Ad

Recently uploaded (20)

PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Classroom Observation Tools for Teachers
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Computing-Curriculum for Schools in Ghana
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Institutional Correction lecture only . . .
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
01-Introduction-to-Information-Management.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Complications of Minimal Access Surgery at WLH
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Classroom Observation Tools for Teachers
human mycosis Human fungal infections are called human mycosis..pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Computing-Curriculum for Schools in Ghana
TR - Agricultural Crops Production NC III.pdf
Cell Types and Its function , kingdom of life
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Institutional Correction lecture only . . .
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Insiders guide to clinical Medicine.pdf
01-Introduction-to-Information-Management.pdf
PPH.pptx obstetrics and gynecology in nursing
Complications of Minimal Access Surgery at WLH
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
O5-L3 Freight Transport Ops (International) V1.pdf

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”.