first:
1. If first character of production is terminal then becomes first.
eg. first(abAb)={a};
2.If a production of this type A->BCD...
means all are variable or non-terminal then
if first(B) donot contains null then
first(A)=first(B)
stop here.
else
then also check for next non terminal like C here
same as above step
and first(A)=First(B)+first(C).
if we get null stop there.
FOLLOW:
if you know first then you can easily go with follow.
1.if a variable is start symbol then follow=$.
2.if a production is of A->(any string1)B(any string2)
then
follow(B)=first(any string2) -{null}
3.if a production is of A->(any string)B
then
follow(B)=follow(A) .
stop
it is very simple, please try to understand!
really good answer, for more visit:www.cmail.99k.org
Copyright © 2026 eLLeNow.com All Rights Reserved.