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 | Set 1 (Introduction, Ambiguity and Parsers)
- Parsing ambiguos grammars using LR parser
- Compiler Design | Construction of LL(1) Parsing Table
- Difference between Bottom-Up Model and Top-Down Model
- Difference between OOP and POP
- Difference between JSP and ASP
- Difference between MP4 and MP3
- Difference between LAN and MAN
- Difference Between SEO and SEM
- Difference Between BFS and DFS
- Difference between 1G and 2G
- Difference between CPU and GPU
- What is the difference between GUI and CUI?
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.