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.

  1. A.

    Leftmost derivation

  2. B.

    Leftmost derivation traced out in reverse

  3. C.

    Rightmost derivation traced out in reverse

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

Explore the full course: Mppsc Assistant Professor