Which of the following derivations does a top-down parser use while parsing an…
2013
Which of the following derivations does a top-down parser use while parsing an input string? The input is scanned from left to right.
- A.
Leftmost derivation
- B.
Leftmost derivation traced out in reverse
- C.
Rightmost derivation traced out in reverse
- D.
Rightmost derivation
Attempted by 84 students.
Show answer & explanation
Correct answer: A
Top down parsers build parse trees starting from the start symbol. They expand non-terminals by always selecting the leftmost one first at each step. This specific process corresponds directly to generating a Leftmost derivation in formal grammar theory.
A video solution is available for this question — log in and enroll to watch it.