Skip to content
Related Articles

Related Articles

Improve Article

Difference between Top down parsing and Bottom up parsing

  • Difficulty Level : Expert
  • Last Updated : 08 May, 2019

There are 2 types of Parsing Technique present in parsing, first one is Top-down parsing and 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:

S.NoTop Down ParsingBottom Up Parsing
1.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.
2.Top-down parsing attempts to find the left most derivations for an input string.Bottom-up parsing can be defined as an attempts to reduce the input string to start symbol of a grammar.
3.In this parsing technique we start parsing from top (start symbol of parse tree) to down (the leaf node of parse tree) in top-down manner.In this parsing technique we start parsing from bottom (leaf node of parse tree) to up (the start symbol of parse tree) in bottom-up manner.
4.This parsing technique uses Left Most Derivation.This parsing technique uses Right Most Derivation.
5.It’s main decision is to select what production rule to use in order to construct the string.It’s main decision is to select when to use a production rule to reduce the string to get the starting symbol.

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :