A bottom-up parser generates :

2018

A bottom-up parser generates :

  1. A.

    Left-most derivation in reverse

  2. B.

    Right-most derivation in reverse

  3. C.

    Left-most derivation

  4. D.

    Right-most derivation

Attempted by 290 students.

Show answer & explanation

Correct answer: B

Answer: A bottom-up parser generates the rightmost derivation in reverse.

Reason: Bottom-up parsing starts from the input tokens and repeatedly replaces the right-hand side of productions by their left-hand side (a reduce operation). Each reduction corresponds to undoing a production application from a rightmost derivation, so the parser reconstructs the rightmost derivation steps in reverse order.

  • Operation style: Bottom-up parsers perform shift and reduce operations, reducing substrings of the already-read input to nonterminals.

  • Derivation correspondence: Each reduce corresponds to one production used in a rightmost derivation, but applied backwards, so the overall derivation built is the rightmost derivation in reverse.

  • Examples: Shift-reduce parsers and the LR family (SLR, LALR, CLR) are common bottom-up parsers.

Contrast: Top-down parsers construct a leftmost derivation directly (for example, LL parsers).

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor