Parsing & Syntax Analysis

Answer & solution
Official answer: D
Step through it (21 steps)
Givens and goal
Use canonical LR(0) parsing for S→ACB, A→aA|ε, C→cC|ε, B→bB|b, with start S. Count shift-reduce conflicts in the ACTION table: A 2; B 3; C 4; D 5.
Approach
Construct the relevant item closures and identify states containing both a shift and a completed item.
Step-by-step solution
1. Augment with S′→S. A completed LR(0) item X→α· requests a reduction on every terminal, without restricting it to FOLLOW(X). It conflicts with any terminal shift present in the same state.
2. The initial state contains S′→·S, S→·ACB, A→·aA, A→·. It shifts a and reduces A→ε, giving one conflicting ACTION cell on a. After shifting a, the state contains A→a·A and the same two A closure items, giving a second conflict on a.
3. After recognizing A, the state contains S→A·CB, C→·cC, C→·. It shifts c and reduces C→ε, giving one conflict on c. After shifting c, the state contains C→c·C with the same C closure items, giving another conflict on c.
4. After recognizing AC, the B closure has B→·bB and B→·b. Shifting b reaches {B→b·B, B→b·, B→·bB, B→·b}. This state shifts b and reduces B→b, giving the fifth conflict.
5. The remaining completed states contain only S′→S·, A→aA·, C→cC·, S→ACB·, or B→bB·; they have no terminal shift. The state before reading B also has no completed item. These account for all 11 canonical states.
6. Therefore there are exactly five conflicting cells, D. Using SLR FOLLOW restrictions instead would be a different parsing method and could change which conflicts remain.