← 🌳 Grammars, Derivations & FIRST/FOLLOW
Subtopic 1 of 4

3.1Derivations: leftmost and rightmost

A derivation rewrites the start symbol into a string. Leftmost always expands the leftmost non-terminal, rightmost the rightmost. Top-down parsers find leftmost derivations; bottom-up parsers find rightmost derivations in reverse.

  • E start
  • E + T E → E + T
  • T + T E → T
  • F + T T → F
  • id + T F → id
  • id + T * F T → T * F
  • id + F * F T → F
  • id + id * F F → id
  • id + id * id F → id

Always the leftmost non-terminal is rewritten. A top-down parser builds exactly this sequence.

Previous year questions: Grammars, Derivations & FIRST/FOLLOW (8)

PYQs are grouped by topic, so this is the full set for Grammars, Derivations & FIRST/FOLLOW; try the ones that match this subtopic. Open all 8 on the topic page.