LR Parsing Classification: Top-Down, Bottom-Up, Recursive, and Predictive

LR Parsing Classification: Top-Down, Bottom-Up, Recursive, and Predictive

Verified Sources
Nov 4, 2026

LR parsing is a bottom-up, shift-reduce, deterministic parsing strategy constructed from LR parsing tables (typically ACTION and GOTO) that simulate a rightmost derivation in reverse while scanning input left-to-right. In the standard definition, the “L” means left-to-right scanning of the input, and the “R” indicates use of a rightmost derivation handle concept in the parsing process.
Therefore, among your options, (ii) Bottom-up parsing is the correct choice.

The other options are not the defining characteristics of LR parsing:

  • (i) Top-down parsing: that’s the family associated with LL parsing (predictive, recursive-descent style).
  • (iii) Recursive parsing: LR parsers are typically table-driven automata; recursion is not the core defining mechanism.
  • (iv) Predictive parsing: “predictive” is the hallmark of LL(1)-style lookahead selection; LR parsing uses LR lookahead sets inside ACTION/GOTO table entries rather than an LL-style single nonterminal expansion prediction.

Key terms

  • LR parsing
  • shift-reduce parser
  • ACTION table
  • GOTO table

⚠️ Important: I attempted web research as required, but external search calls are currently failing in this environment (tool usage limit). I’m still providing a correct conceptual answer based on standard compiler-construction definitions.

type="tip" title="How to recognize LR parsing quickly" content="If a question mentions ACTION/GOTO tables, shift/reduce moves, or “handle” recognition, it’s almost certainly LR = bottom-up shift-reduce parsing."

How LR parsing builds a parse (conceptual lifecycle)

Start state

1. Initialization

Create a stack with the initial state; input pointer at the start."

Read next input symbol

2. Scan lookahead

Use current state + lookahead to choose ACTION."

Move input into stack

3. Shift

If ACTION says shift, push the symbol and advance input."

Apply a production

4. Reduce

If ACTION says reduce by A→βA \to \beta, pop ∣β∣|\beta| symbols."

Transition after reduction

5. GOTO

Use GOTO with the new top state and AA to push the nonterminal."

Successful parse

6. Accept

When ACTION is accept, the parse is complete."

Core mechanics of an LR shift-reduce parser (ACTION/GOTO simulation)

  1. 1
    Step 1

    Push initial state onto the stack. Set input pointer to the first token.

  2. 2
    Step 2

    Let aa be the current lookahead token from the input.

  3. 3
    Step 3

    Let ss be the state on top of the stack. Use ACTION[ss, aa] to decide.

  4. 4
    Step 4

    If ACTION[ss, aa] = shift tt, push aa and state tt, then advance the input pointer.

  5. 5
    Step 5

    If ACTION[ss, aa] = reduce by A→βA \to \beta, pop ∣β∣|\beta| stack symbols.

  6. 6
    Step 6

    Let s′s' be the new top state. Push AA, then push GOTO[s′s', AA].

  7. 7
    Step 7

    "If ACTION[ss, aa] = accept, stop successfully; if no valid action exists, parsing fails."

    Key terms

    • lookahead
    • handle
    • reduce

Why the correct option is (ii) Bottom-up parsing

LR parsers work by reducing toward the start symbol. Reductions correspond to recognizing handles (RHS patterns) in the current partially built structure, which is characteristic of bottom-up parsing. This is the opposite direction of top-down parsing, which predicts and expands from the start symbol.

A compact conceptual contrast:

Multiple-choice reasoning (i)–(iv)

Which statement best matches LR parsing?

Binary qualitative alignment (1 = matches, 0 = does not match)

Knowledge Check

Question 1 of 4
Q1Single choice

LR parsing is fundamentally characterized by which parsing direction?