Previous Algorithm: Illustration
1) Follow(S) := {$}
2) Apply the following rules until no Follow set can be changed:
• if A ® xBy Î P then
a
z
 x
S
…
$
2a) if y ¹ e then add all symbols
from First(y) to Follow(B)
2a:
A
 x
 y
B
a Î First(y)
a Î Follow(B)
a
z
 x’
2b) if Empty(y) = {e} then add all
symbols from Follow(A) to Follow(B)
A
 x
 y
B
2b:
a Î Follow(A)
e
e
e
a Î Follow(B)
30/57