COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In which parsing, the parser constructs the parse tree from the start symbol and transforms it into the input symbol.
A
Bottom-up parsing
B
Top-down parsing
C
None of the above
D
Recursive Descent Parser
Explanation: 

Detailed explanation-1: -When the parser starts constructing the parse tree from the start symbol and then tries to transform the start symbol to the input, it is called top-down parsing. Recursive descent parsing : It is a common form of top-down parsing. It is called recursive as it uses recursive procedures to process the input.

Detailed explanation-2: -Recursive descent is a top-down parsing technique that constructs the parse tree from the top and the input is read from left to right. It uses procedures for every terminal and non-terminal entity. This parsing technique recursively parses the input to make a parse tree, which may or may not require back-tracking.

Detailed explanation-3: -Explanation: Bottom-up parser generates the right-most derivation in reverse. It constructs the parse tree from the input string to the root and tries to construct the right-most derivation of the specified string backward.

Detailed explanation-4: -Constructing a parse tree for an input string beginning at the leaves and going towards the root is called bottom-up parsing. A general type of bottom-up parser is a shift-reduce parser.

Detailed explanation-5: -Explanation: In top-down parsing, the parser constructs the parse tree from the start symbol and transforms it into the input symbol. It is also referred to as predictive or recursive parsing.

There is 1 question to complete.