โ๏ธ If ๐บ โ A then A โ B = A
โ๏ธ If ๐บ โ A then A โ B = (A - {๐บ}) U B
{a, b, c} โ {c, d} = {a, b, c}
{a, b, c, ๐บ} โ {c, d} = {a, b, c, d}
{a, b, ๐บ} โ {c, d, ๐บ} = {a, b, c, d,๐บ}
เน Calculate LOOKAHEAD
โฌ S -> aBA|BB|ABc, A->dA|b, B-> ๐บ
โฌ FIRST(S) = {a,๐บ,d,b}, FIRST(A) = {d,b}, FIRST(B) = {๐บ}
โฌ FOLLOW(S) = {$}, FOLLOW(A) = {c, $}, FOLLOW(B) = {c} U {d,b} = {c, d, b, $}
LOOKAHEAD(S -> aBA) = FIRST(aBA) โ FOLLOW(S) = {a}
LOOKAHEAD(S -> BB) = FIRST(BB) โ FOLLOW(S) = {$}
LOOKAHEAD(S -> ABc) = FIRST(ABc) โ FOLLOW(S) = {d,b}
LOOKAHEAD(A -> dA) = FIRST(dA) โ FOLLOW(A) = {d}
LOOKAHEAD(A -> b) = FIRST(b) โ FOLLOW(A) = {b}
LOOKAHEAD(B -> ๐บ) = FIRST(๐บ) โ FOLLOW(B) = {$, d, b, c}