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.No||Top Down Parsing||Bottom 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.|
- Parsing | Set 2 (Bottom Up or Shift Reduce Parsers)
- Parsing | Set 3 (SLR, CLR and LALR Parsers)
- Parsing ambiguos grammars using LR parser
- Parsing | Set 1 (Introduction, Ambiguity and Parsers)
- Compiler Design | Construction of LL(1) Parsing Table
- Difference Between BFS and DFS
- Difference between RAM and ROM
- What is the difference between GUI and CUI?
- Web 1.0, Web 2.0 and Web 3.0 with their difference
- Difference between H.323 and SIP
- Difference between ++*p, *p++ and *++p
- Difference between CPU and GPU
- Difference between Blu-ray and DVD
- Difference between MAN and WAN
- Difference between PNG and GIF
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.