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.
EstartE + TE → E + TT + TE → TF + TT → Fid + TF → idid + T * FT → T * Fid + F * FT → Fid + id * FF → idid + id * idF → 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.