The GATE Grind

GATE 2014 CS (CS1) – Question 44

Compiler Design · Parsing and Syntax Analysis · 2 marks · Multiple choice

A canonical item set is S → L · > R and Q → R ·. On input symbol <, the set has ______.

  1. a shift-reduce and a reduce-reduce conflict
  2. a shift-reduce but no reduce-reduce conflict
  3. a reduce-reduce but no shift-reduce conflict
  4. neither a shift-reduce nor a reduce-reduce conflict

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (D) neither a shift-reduce nor a reduce-reduce conflict

Explanation

The shift item expects > after its dot, so it cannot shift on <. The completed item Q→R can supply at most one reduction on <. Thus there is neither a shift-reduce nor a reduce-reduce conflict on that symbol, **D**. A completed item alone is not a conflict.