COMPUTER SCIENCE AND ENGINEERING
COMPILER DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
leftmost
|
|
rightmost
|
|
either left or right
|
|
none
|
Detailed explanation-1: -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-2: -Top-Down Parsers uses leftmost derivation to construct a parse tree.
Detailed explanation-3: -The reason that top-down parsing follow the left-most derivation for an input string and not the right-most derivation is that the input string is scanned by the parser from left to right, one symbol/token at a time.
Detailed explanation-4: -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.
Detailed explanation-5: -If the sentential form of an input is scanned and replaced from left to right, it is called left-most derivation. The sentential form derived by the left-most derivation is called the left-sentential form.