SlideShare a Scribd company logo
1 of 9
Gandhinagar Institute of Technology
SUBJECT – CD (2170701)
Non-predictive Parser
Prepared By-
Tarj Mehta (170120107074)
Guided By – Prof. Archana Singh
Non-predictive parser
•It is a top-down parser, so it builds the parse tree
from top to bottom starting from non-terminal.
•It is also known as recursive-descent parser as it
uses a set of recursive procedures to scan its input.
•This parsing technique may involve backtracking:
that is making repeated scan of its input.
Working
String
Grammar
Parse Tree
Recursive Descent
Parser
Example
• Consider the grammar given below:
S  cAd
A  ab | a
• Consider the input string: w = c a d
input pointer
Step-1: S  cAd
S if (input pointer == descent pointer)
increment descent pointer by 1
c A d increment input pointer by 1
Descent pointer
• Step-2: w = c a d
input pointer
S A is non-terminal so expand it
c A d
descent pointer
• A  ab | a Now,
S input pointer == descent pointer
incrementing both pointers in next
c A d step
a b
descent pointer
• Step-3: w = c a d
input pointer
S
c A d
a b
descent pointer
Here, input pointer != descent pointer
Now backtracking to the immediate non-terminal
• Step – 4: w = c a d
input pointer
S input pointer == descent pointer
incrementing both the pointers
c A d
a
descent pointer
Now, S
w = c a d
c A d
input pointer
Here, a
input pointer == descent pointer
descent pointer
• As both the pointers are equal and all the elements of input string
have been parsed, we can say that the string has been successfully
parsed.
• The final parse tree can be given as follows:
S
c A d
a
• The given grammar was small to solve, but in case of big grammar
the non-predictive parser technique becomes very long.
• Hence to over come this, predictive parser was introduced.
Thank YOU.

More Related Content

Similar to non-predective parser

IAP presentation-1.pptx
IAP presentation-1.pptxIAP presentation-1.pptx
IAP presentation-1.pptx
HirazNor
 

Similar to non-predective parser (20)

DEF CON 27 - DAMIEN CAUQUIL - defeating bluetooth low energy 5 prng for fun a...
DEF CON 27 - DAMIEN CAUQUIL - defeating bluetooth low energy 5 prng for fun a...DEF CON 27 - DAMIEN CAUQUIL - defeating bluetooth low energy 5 prng for fun a...
DEF CON 27 - DAMIEN CAUQUIL - defeating bluetooth low energy 5 prng for fun a...
 
Breadth first search
Breadth first search Breadth first search
Breadth first search
 
LSH
LSHLSH
LSH
 
1d-HALF ADDER & FULL ADDER-PPT.pdf
1d-HALF ADDER & FULL ADDER-PPT.pdf1d-HALF ADDER & FULL ADDER-PPT.pdf
1d-HALF ADDER & FULL ADDER-PPT.pdf
 
Fp12_Efficient_SCM
Fp12_Efficient_SCMFp12_Efficient_SCM
Fp12_Efficient_SCM
 
Predictive parser
Predictive parserPredictive parser
Predictive parser
 
LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 
ARITHMETIC_CIRCUITS_IN_CMOS_VLSI.pptx
ARITHMETIC_CIRCUITS_IN_CMOS_VLSI.pptxARITHMETIC_CIRCUITS_IN_CMOS_VLSI.pptx
ARITHMETIC_CIRCUITS_IN_CMOS_VLSI.pptx
 
IAP presentation-1.pptx
IAP presentation-1.pptxIAP presentation-1.pptx
IAP presentation-1.pptx
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive Parsing
 
Merge sort
Merge sortMerge sort
Merge sort
 
Parallel DNA Sequence Alignment
Parallel DNA Sequence AlignmentParallel DNA Sequence Alignment
Parallel DNA Sequence Alignment
 
Efficient path profiling
Efficient path profilingEfficient path profiling
Efficient path profiling
 
Lecture15 anti aliasing
Lecture15 anti aliasingLecture15 anti aliasing
Lecture15 anti aliasing
 
LECTURE-1 (1).pptx
LECTURE-1 (1).pptxLECTURE-1 (1).pptx
LECTURE-1 (1).pptx
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
 
C sharp part 001
C sharp part 001C sharp part 001
C sharp part 001
 
Unit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxUnit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptx
 

Recently uploaded

+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
Health
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Recently uploaded (20)

Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.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
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 

non-predective parser

  • 1. Gandhinagar Institute of Technology SUBJECT – CD (2170701) Non-predictive Parser Prepared By- Tarj Mehta (170120107074) Guided By – Prof. Archana Singh
  • 2. Non-predictive parser •It is a top-down parser, so it builds the parse tree from top to bottom starting from non-terminal. •It is also known as recursive-descent parser as it uses a set of recursive procedures to scan its input. •This parsing technique may involve backtracking: that is making repeated scan of its input.
  • 4. Example • Consider the grammar given below: S  cAd A  ab | a • Consider the input string: w = c a d input pointer Step-1: S  cAd S if (input pointer == descent pointer) increment descent pointer by 1 c A d increment input pointer by 1 Descent pointer
  • 5. • Step-2: w = c a d input pointer S A is non-terminal so expand it c A d descent pointer • A  ab | a Now, S input pointer == descent pointer incrementing both pointers in next c A d step a b descent pointer
  • 6. • Step-3: w = c a d input pointer S c A d a b descent pointer Here, input pointer != descent pointer Now backtracking to the immediate non-terminal
  • 7. • Step – 4: w = c a d input pointer S input pointer == descent pointer incrementing both the pointers c A d a descent pointer Now, S w = c a d c A d input pointer Here, a input pointer == descent pointer descent pointer
  • 8. • As both the pointers are equal and all the elements of input string have been parsed, we can say that the string has been successfully parsed. • The final parse tree can be given as follows: S c A d a • The given grammar was small to solve, but in case of big grammar the non-predictive parser technique becomes very long. • Hence to over come this, predictive parser was introduced.