Compiler - Why is the grammar not suitable for shift-reduce Consider this example:

stmt =&gt; if (expr) stmt | if (expr) stmt else stmt | other


Why can't we use shift-reduce on this?

This is a compiler homework and I really need to answer it.
The grammar is ambiguous, so no deterministic parsing technique will be able to handle it. The parsing techniques called "shift-reduce" are all deterministic.