Which of the following derivations does a top-down parser use while parsing an…
2021
Which of the following derivations does a top-down parser use while parsing an input string? The input is assumed to be scanned in left to right order.
- A.
Leftmost derivation
- B.
Leftmost derivation traced out in reverse
- C.
Rightmost derivation
- D.
Rightmost derivation traced out in reverse
- E.
Question not attempted
Attempted by 89 students.
Show answer & explanation
Correct answer: A
A top-down parser expands the grammar starting from the start symbol and always replaces the leftmost non-terminal first while scanning input left to right.
⇒ Hence, it uses Leftmost derivation