• Input: G = (N, T, P, S);
• Output: Follow(A) for every A Î N
• Method:
• Follow(S) := {$};
• Apply the following rules until no Follow set
  can be changed:
• if A ® xBy Î P then
• if y ¹ e then
add all symbols from First(y) to Follow(B);
• if Empty(y) = {e} then
  add all symbols from Follow(A) to Follow(B);
Algorithm: Follow(A)
29/57