There are 2 types of Parsing techniques present parsing, the first one is Top-down parsing and the second one is Bottom-up parsing. Top-down parsing is a parsing technique that first looks at the highest level of the parse tree and works down the parse tree by using the rules of grammar while Bottom-up Parsing is a parsing technique that first looks at the lowest level of the parse tree and works up the parse tree by using the rules of grammar.
There are some differences present to differentiate these two parsing techniques, which are given below:
Top-Down Parsing |
Bottom-Up Parsing |
It is a parsing strategy that first looks at the highest level of the parse tree and works down the parse tree by using the rules of grammar. |
It is a parsing strategy that first looks at the lowest level of the parse tree and works up the parse tree by using the rules of grammar. |
Top-down parsing attempts to find the left most derivations for an input string. |
Bottom-up parsing can be defined as an attempt to reduce the input string to the start symbol of a grammar. |
In this parsing technique we start parsing from the top (start symbol of parse tree) to down (the leaf node of parse tree) in a top-down manner. |
In this parsing technique we start parsing from the bottom (leaf node of the parse tree) to up (the start symbol of the parse tree) in a bottom-up manner. |
This parsing technique uses Left Most Derivation. |
This parsing technique uses Right Most Derivation. |
The main leftmost decision is to select what production rule to use in order to construct the string. |
The main decision is to select when to use a production rule to reduce the string to get the starting symbol. |
Example: Recursive Descent parser. |
Example: ItsShift Reduce parser. |
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing
Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.
Last Updated :
19 Jan, 2023
Like Article
Save Article