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.

  1. A.

    Leftmost derivation

  2. B.

    Leftmost derivation traced out in reverse

  3. C.

    Rightmost derivation

  4. D.

    Rightmost derivation traced out in reverse

  5. 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

Explore the full course: Bpsc