1 votes 1 votes How to find FIrst and Follow in following case? S -> aAbB | bAaB | epsilon A -> S B -> S I am little confused because of the production A->S, does it say that Follow(A) is subset of Follow(S) or Follow(S) is subset of Follow(A) or both are equal? Compiler Design compiler-design parsing theory-of-computation + – Rakesh K asked Oct 13, 2016 edited Oct 13, 2016 by Rakesh K Rakesh K 5.2k views answer comment Share Follow See all 7 Comments See all 7 7 Comments reply Show 4 previous comments shivangi5 commented Dec 12, 2017 reply Follow Share Got it but 2 entries would be under (A,a) and (A,b) 0 votes 0 votes Shivansh Gupta commented Dec 12, 2017 reply Follow Share Under (S,a) entry : S$\rightarrow$aAbB, S$\rightarrow$ϵ Under (S,b) entry : S$\rightarrow$bAaB, S$\rightarrow$ϵ Under (A,a) and (A,b) : A$\rightarrow$S 0 votes 0 votes hs_yadav commented Dec 12, 2017 reply Follow Share no ..under (A,a) and(A,b)...we would get...A->S First of S(a,b) similarly under (B,a) and (B,b)....B->S 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes First(S)={a,b,epsilon} First(A)={a,b,epsilon} First(B)={a,b,epsilon} Follow(S)={$,a,b} Follow(A)={a,b} Follow(B)={$,a,b} anonymous answered Apr 27, 2017 anonymous comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes a b $ S S-->aAbB S-->bAaB S--e A A-->S A--->e A--->S A--->e B B-->S B-->S B---e Akash Mittal answered Dec 9, 2017 Akash Mittal comment Share Follow See 1 comment See all 1 1 comment reply Ajay Jadhav commented Dec 9, 2017 reply Follow Share I think S->epsilon will be under column a and b , since S-->epsilon needs to be put under follow(S) which is {a,b} 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Posting the answer late, but i think it will help others who will land up to this question. a b $ S S → aAbB S → ε S → bAaB S → ε S → ε A A → S A → S B B → S B → S B → S Thus, from the above table entries we can see that their are two entires where we have multiple productions. Hence 2 is the answer. karnanilavesh answered Aug 15, 2020 karnanilavesh comment Share Follow See all 0 reply Please log in or register to add a comment.