MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

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
Both a and b
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: -Key Points. A top-down parsing technique parses the input by starts constructing a parse tree from the root node moving down to the leaf nodes. A top-down parser uses the leftmost derivation to generate the string.

Detailed explanation-3: -Top-down parsing uses leftmost derivation. Bottom-up parsing uses the rightmost derivation. 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 grammar.

Detailed explanation-4: -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.

Detailed explanation-5: -Top-down parsing (LL) A top down parser is called LL parser because it parses the input from Left to right, and constructs a Leftmost derivation of the sentence.

There is 1 question to complete.