Skip to content
Related Articles

Related Articles

Difference between Top down parsing and Bottom up parsing

View Discussion
Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 18 May, 2022
View Discussion
Improve Article
Save Article

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 ParsingBottom-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.
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!