Dragon book says:
An ambiguous grammar can never be LR.
And then immediately further it says:
For example, consider the dangling-else grammar:
$\begin{align} stmt \rightarrow & \textbf{ if } expr \textbf{ then }stmt \\ &| \textbf{ if } expr \textbf{ then }stmt \textbf{ else } stmt \\ &|\textbf{ other} \end{align} $
If we have a shift reduce parser in configuration
$$ \begin{matrix} STACK & INPUT \\ ...\textbf{if }expr\textbf{ then }stmt & \textbf{else...} \end{matrix} $$
we cannot tell whether $\textbf{if }expr\textbf{ then }stmt$ is the handle, no matter what appears below it on the stack. Here there is a shiftl reduce conflict. Depending on what follows the $\textbf{else}$** on the input, it might be correct to reduce $\textbf{if }expr\textbf{ then }stmt$, or it might be correct to shift $\textbf{else}$ and then to look for another $stmt$ to complete the alternative $\textbf{if }expr\textbf{ then }stmt \textbf{ else } stmt$.
My question is quite simple one. The author starts with saying fact about "ambiguous" grammar but then he gives example of problem with same prefix of right sides of two productions (say non deterministic grammar) but not really related to the ambiguousness of grammar.
Am I right? Also what does that mean? LR grammar cannot work with both: Non deterministic and ambiguous grammars?