ellipsisRepresents the final symbol of the other related production, at the beginning, the ellipsis is not in the first set case one if a is only on the right side of the →, then ={a}, Example M→α,first (alpha) ={α} situation Daini For a→bcdefg, One if no b→ε, then first (A) ={...} ∪first (b), then ask first (b) Two if there is b→ε, then first (A) ={...} ∪ (First (b)-{ε}) ∪first (CDEFG), then respectively first (b)-{ε}, first (CDEFG) case if g→ε, then first (G) ={...} ∪{ε} Follow set case if S is the start symbol (generally the first production), then follow (S) ={......,$} Case II If there is a production A→ΑBCD, and ε does not belong to primary (CD) So follow (B) ={...} ∪ (First (CD)) Two if there is a production A→ΓBCD and ε belongs to first (CD) then follow (B) ={...} ∪ (First (CD)-{ε}) ∪follow (a) case B if there is a production m→cdb, then follow (B) ={...} ∪follow (M) example for grammar g[a]a→bcc|gdb b→bcde|εc→dab|cad→dd|εe→gaf|c first set First look → Left (A) =first (BCc) ∪fisrt (GDB) = (First (B)-{ε}) ∪first (Cc) ∪{g} & nbsp ={b}∪first (DABC) ∪first (CAC) ∪{g} ={b}∪first (DDABC) ∪first (aBc) ∪{c}∪{g} ={ B,d,a,c,g}first (B) =first (BCDE) ∪first (ε) ={b,ε}first (c) =first (DaB) ∪first (CA) =first (Ddab) ∪first (AB) ∪{c} equivalent (first (D)-{ ε}) ∪first (AB) ∪{c} ={d,a,c}first (d) =first (DD) ∪first (ε) ={d,ε}first (E) =first (gAf) ∪first (c) ={g,c}---------------------------------- ---------------------------------------------------------------------follow set First look → right follow (A) ={$}∪{f}={f,$}follow (B) =first (Cc) ∪follow (A) ∪follow (C) ={D,A,C}∪{F , $}∪follow (c) First go to follow (c) ={A,C,D,G,F,$}FO Llow (C) ={c}∪first (DE)   ={c}∪{d}∪first (E) ={c,d,g}follow (d) = (First (B)-{ε}) ∪follow (A) ∪first (E) ∪{a}∪follow (d) ={b}∪{f,$}∪{g,c}∪{a} &NBSP ; ={a,b,g,c,f,$}follow (E) =follow (b) ={a,c,d,g,f,$}
First set and follow set