\begin{frame}{Ambiguity in Programming Languages}
The following production rules (from ALGOL 60) became known as \emph{dangling else problem}:
\[
\begin{array}{rcl}
{\it Statement} &\rightarrow& {\tt if}~{\it Condition}~{\tt then}~{\it Statement}~~\mid \vspace{1mm} \\
&& {\tt if}~{\it Condition}~{\tt then}~{\it Statement}~{\tt else}~{\it Statement}~~\mid \vspace{1mm} \\
&& \cdots \vspace{3mm} \\
{\it Condition} &\rightarrow& \cdots
\end{array}
\]
\pause
\begin{goal}{}
There are two derivation trees for
\begin{talign}
\texttt{if } \ldots \texttt{ then if } \ldots \texttt{ then } \ldots \texttt{ else } \ldots
\end{talign}
\pause
The production rules are \alert{ambiguous}.
\end{goal}
\bigskip
{\footnotesize Donald Knuth, \textit{The Remaining Trouble Spots in ALGOL 60}, CACM, 1967}
\end{frame}