I am doing exam questions for compilers. The question is to find the first and follow sets of the following grammar:
S → uBDz
B → Bv | w
D → EF
E → y | e
F → x | e
This is what I got when I calculated the First set:
First
S u,v,w,y,x,z,e
B v,w
D y,x,e
E y,e
F x,e
My lecturer already did a solution but I can't seem to understand where he got the answer:
First Follow
S u $
B w y,x,z,y
D y,x,e z
E y,e x,z
F x,e z
PS. e = epsilon
PSS. this is the example I followed https://www.youtube.com/watch?v=dDoo5BF9T4E&t=787s
B
should bev
,x
,y
,z
. – ggorlen