Which of the following derivation does a top-down parser use while parsing a…
2020
Which of the following derivation does a top-down parser use while parsing a input string? The input is assumed to be scanned in left to right order.
- A.
Topmost derivation
- B.
Leftmost derivation traced out in reverse
- C.
Leftmost derivation
- D.
Rightmost derivation
Attempted by 102 students.
Show answer & explanation
Correct answer: C
The correct option is C (Leftmost derivation).
A top-down parser constructs the parse tree from the root (start symbol) down to the leaves (input tokens). When scanning the input string from left to right, it always expands the leftmost non-terminal symbol first at each step. This process corresponds exactly to finding a Leftmost Derivation (LMD) for the input string.