3 votes 3 votes Consider the Following Grammar P - > S S - > A | A ;S A - > id = E E - > E+E | E-E | E*E | E/E | (E) | T T - > id | num Calculate FIRST and FOLLOW for each non terminal. Compiler Design compiler-design grammar parsing first-and-follow descriptive + – LavTheRawkstar asked Jun 25, 2016 • retagged Jun 21, 2022 by Lakshman Bhaiya LavTheRawkstar 1.5k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 3 votes 3 votes First(P)={id} Follow(P)={$} First(S)={id} Follow(S)={ $} First(A)={id} Follow(A)={ ; , $} First(E)={ ( , id ,num } Follow(E)={ + , - , * , / , ) , ; , $ } First(T) ={id , num} Follow(T)={ + , - , * , / , ) , ; , $ } LeenSharma answered Jun 25, 2016 • edited Jun 25, 2016 by LeenSharma LeenSharma comment Share Follow See all 6 Comments See all 6 6 Comments reply cse23 commented Jun 25, 2016 reply Follow Share A - > id = E I think follow of E will also include follow of A from this production which is { ; , $}....am I right? 2 votes 2 votes LeenSharma commented Jun 25, 2016 reply Follow Share yes,Right.i didn't notice that production. Thank You. updated 1 votes 1 votes chandankannaujia commented Aug 29, 2016 reply Follow Share i think first(P)=first(S)=first(A)={ id,num,( }=first(E) first(T)={id,num} am I RIGHT plz comment 0 votes 0 votes Pavan Kumar Munnam commented Aug 29, 2016 reply Follow Share No u are wrong 0 votes 0 votes Human commented Aug 18, 2018 reply Follow Share Your first (A) is wrong.. first (A) =id.. therefore first (A) is not equal to first(E) 0 votes 0 votes `JEET commented Aug 30, 2019 reply Follow Share First we need to convert the E production to non left recursive grammar? Isn't it?? 0 votes 0 votes Please log in or register to add a comment.