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

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...
Felipe Prado
 
Breadth first search
Breadth first search Breadth first search
Breadth first search
piku das
 
LSH
LSHLSH
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
ssusera0b94b
 
Predictive parser
Predictive parserPredictive parser
Predictive parser
Jothi Lakshmi
 
ARITHMETIC_CIRCUITS_IN_CMOS_VLSI.pptx
ARITHMETIC_CIRCUITS_IN_CMOS_VLSI.pptxARITHMETIC_CIRCUITS_IN_CMOS_VLSI.pptx
ARITHMETIC_CIRCUITS_IN_CMOS_VLSI.pptx
Prasad311324
 
IAP presentation-1.pptx
IAP presentation-1.pptxIAP presentation-1.pptx
IAP presentation-1.pptx
HirazNor
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive Parsing
Tanzeela_Hussain
 
Merge sort
Merge sortMerge sort
Parallel DNA Sequence Alignment
Parallel DNA Sequence AlignmentParallel DNA Sequence Alignment
Parallel DNA Sequence Alignment
Giuliana Carullo
 
Efficient path profiling
Efficient path profilingEfficient path profiling
Efficient path profiling
Aakriti Gupta
 
Lecture15 anti aliasing
Lecture15 anti aliasingLecture15 anti aliasing
Lecture15 anti aliasing
Siddharth Maloo
 
LECTURE-1 (1).pptx
LECTURE-1 (1).pptxLECTURE-1 (1).pptx
LECTURE-1 (1).pptx
MRKUsafzai0607
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
LakshmiSamivel
 
UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
GovindUpadhyay25
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
Arul Jothi Yuvaraja
 
C sharp part 001
C sharp part 001C sharp part 001
C sharp part 001
Ralph Weber
 
Unit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxUnit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptx
Yogesh Pawar
 

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

block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 

Recently uploaded (20)

block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 

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.