Top down parsing technique is a parsing technique which starts from the top of the parse tree, move downwards, evaluates rules of grammer.
Top down parsing technique is again a parsing technique which starts from the lowest level of the parse tree, move upwards and evaluates rules of grammer.
Following are some of the important differences between Top Down Parsing and Bottom Up Parsing.
Sr. No. | Key | Top Down Parsing | Bottom Up Parsing |
---|---|---|---|
1 | Strategy | Top down approach starts evaluating the parse tree from the top and move downwards for parsing other nodes. | Bottom up approach starts evaluating the parse tree from the lowest level of the tree and move upwards for parsing the node. |
2 | Attempt | Top down parsing attempts to find the left most derivation for a given string. | Bottom up parsing attempts to reduce the input string to first symbol of the grammer. |
3 | Derivation Type | Top down parsing uses leftmost derivation. | Bottom up parsing uses the rightmost derivation. |
4 | Objective | Top down parsing searches for a production rule to be used to construct a string. | Bottom up parsing searches for a production rule to be used to reduce a string to get a starting symbol of grammer. |