1.
1. If X is a terminal then First(X) is just X 2. If there is a Production X -> epsilon then add epsilon to first(X) 3. If there is a Production X -> Y1Y2..Yk then add first(Y1Y2..Yk) to first(X)
4.
4. First(Y1Y2..Yk) is either
1.
1. First put ⊥ (the end of input marker) in Follow(S) (S is the start symbol) 2. If there is a production A -> aBb, (where 'a' can be a whole string) then everything in FIRST(b) except for epsilon is placed in FOLLOW(B). 3. If there is a production A -> aB, then everything in FOLLOW(A) is in FOLLOW(B) 4. If there is a production A -> aBb, where FIRST(b) contains epsilon, then everything in FOLLOW(A) is in FOLLOW(B)