0 votes 0 votes Find first and follow of the given grammar? S->AB A->BS/a/€ B->AS/b Compiler Design compiler-design grammar parsing first-and-follow + – saumya mishra asked Jun 3, 2018 • retagged Jun 20, 2022 by Lakshman Bhaiya saumya mishra 3.4k views answer comment Share Follow See 1 comment See all 1 1 comment reply akash.dinkar12 commented Jun 3, 2018 reply Follow Share first (S) = {a,b} first(A) ={a,b,ϵ} first(B) ={a,b} follow(S) ={$,a,b} follow(A)={a,b} follow (B)= {$,a,b} 1 votes 1 votes Please log in or register to add a comment.
0 votes 0 votes Check this Kajal Khobragade answered Jun 7, 2018 Kajal Khobragade comment Share Follow See all 4 Comments See all 4 4 Comments reply Deepak Poonia commented Jun 7, 2018 reply Follow Share You should not remove Left recursion. First and follow operations are defined for any CFG grammar.. You must be confusing them with $LL(1)$ grammar. Even if the question were for checking $LL(1)$ or not...We shuold not remove left recursion or etc... Just give answer according to the given grammar. 0 votes 0 votes Kajal Khobragade commented Jun 7, 2018 reply Follow Share thanks @ Deepakk Poonia (Dee) sir, I understood your point. For this question first and follow for given productions came similar after removing left recursion so i got confused but now it is clear that first and follow for the grammar of other examples will be different before and after removing left recursion. So, i should answer according to question shouldn't try to modify it. thanks for pointing out :) 1 votes 1 votes Deepak Poonia commented Jun 7, 2018 reply Follow Share Could you give some example in which Before and After removal of Left recursion, first or follow or both becomes different for symbols(variables) in the Original grammar.. ? As per the definition of First and Follow, It doesn't seem obvious. 0 votes 0 votes Kajal Khobragade commented Jun 7, 2018 reply Follow Share check for this example E ->E +T/T T->T*F/F F->(E)/id 0 votes 0 votes Please log in or register to add a comment.