Computer Sciences > GATE 2026 SET-2 > Compiler Design
Consider the canonical 𝐿𝑅(0) parsing of the grammar below using terminals {𝑎,𝑏,𝑐} and non-terminals {𝐴,𝐵,𝐶,𝑆} with 𝑆 as the start symbol.
S→𝐴𝐶𝐵
A→𝑎𝐴 | 𝜖
C→𝑐𝐶 | 𝜖
B→𝑏𝐵 | 𝑏
Which one of the following options gives the number of shift-reduce conflicts that will occur in the 𝐿𝑅(0) ACTION table?
A
2
B
3
C
4
D
5

Correct : d

The correct answer is Option D — 5 shift-reduce conflicts.
A shift-reduce conflict in an LR(0) state occurs when the state contains both a complete item (dot at the end → reduce) and an item with the dot before a terminal (→ shift). The grammar has ε-productions for A and C, which introduce complete items into states alongside shift items, creating conflicts.
State I0 contains A→• (reduce A→ε) and A→•aA (shift ''''a'''') → Conflict 1.
State I1 = GOTO(I0, A) contains C→• (reduce C→ε) and C→•cC (shift ''''c'''') → Conflict 2.
State I2 = GOTO(I0, a) contains A→• (reduce A→ε) and A→•aA (shift ''''a'''') → Conflict 3.
State I5 = GOTO(I1, c) contains C→• (reduce C→ε) and C→•cC (shift ''''c'''') → Conflict 4.
State I8 = GOTO(I4, b) contains B→b• (reduce) and B→b•B (shift ''''b'''') → Conflict 5.
No other states produce shift-reduce conflicts. The B production B→bB|b causes a conflict because both B→b• and B→b•B appear in the same state. The ε-productions of A and C each cause conflicts in two states — one at the initial state and one in the recursive state.

Similar Questions

Match the following according to input(from the left column) to the compiler phase(in the right column) that process it: (P)Syntax Tree (i)...
#168 MCQ
Consider the following code segment. x = u - t; y = x * v; x = y + w; y = t - z; y = x * y; The minimum number of total variables required to convert the abo...
#575 Fill in the Blanks
Consider the following grammar: stmt -> if expr then else expr; stmt | ε expr -> term relop term | term term -> id | number id -> a | b | c number -> [...
#594 Fill in the Blanks

Related Topics

GATE CS 2026 Set-2 Q41 LR(0) shift-reduce conflicts GATE 2026 canonical LR parsing GATE CS LR(0) ACTION table GATE 2026 compiler design GATE CS 2026 shift reduce conflict epsilon GATE LR parsing conflicts GATE 2026 bottom-up parsing GATE CS

Unique Visitor Count

Total Unique Visitors

Loading......