70/136
\begin{frame}{$\follow{A}$}
  The sets $\first{A}$ are not yet sufficient for `predictive' parsing,\\
  if there are derivations $A \Rightarrow^+ \lambda$.
  \pause\bigskip
  
  \begin{goal}{}
    We consider the terminal letters that can follow a variable:
    \begin{talign}
      \follow{A} = \{\, a \in T \mid S \Rightarrow^* \ldots A a \ldots \,\}
    \end{talign}
    %\cup
    %\{ \lambda \mid S \Rightarrow^* u A \} $
  \end{goal}
  Intuition: $a \in \follow{A}$ if $A$ can be followed by $a$ in a derivation.
  \pause\medskip
  
  We use $\$$ as a special `\emph{end of word}' symbol.
  \begin{block}{Algorithm}
  \begin{itemize}
  \pause
    \item $\follow{S} \supseteq \{\,\$\,\}$
  \pause
    \item $\follow{A} \supseteq \first{w} \setminus \{\,\lambda\,\}$ for every rule $B \rightarrow v A w$
  \pause
    \item $\follow{A} \supseteq \follow{B}$ for rules $B \to v A w$ with $\lambda \in \first{w}$
  \end{itemize}
  \end{block}
\end{frame}