622 views
2 votes
2 votes
IS IT NECESSARY TO REMOVE LEFT RECURSION FOR FINDING FIRST AND FOLLOW ??

1 Answer

1 votes
1 votes

NO i think only process change little bit

 I have grammar

EX:-  S->SA|A
      A->a

Start from bottom A->a , gives FIRST(A)={a}

S->A , gives FIRST(S)=FIRST(A)={a}

S->SA , gives FIRST(S)=FIRST(S) , I think problem arises here. In such recursive calls rules says calculate FIRST(S) till it changes i.e. until elements are added in FIRST(S) continue to calculate. Once it stops changing that is you answer

Therefore FIRST(S)=FIRST(S)={a} , you call FIRST(S) as many times possible it won't change. Parsing Table:

So there are two entries for (S,a). Thus it is not LL(1

Related questions

2 votes
2 votes
2 answers
2
s_dr_13 asked Jan 3, 2022
461 views
if a grammar is CLR(1) with no mergeable states, then it is LALR(1) ? I suppose it is “yes”, am I right?
0 votes
0 votes
1 answer
3
0 votes
0 votes
1 answer
4
Hirak asked Jun 1, 2019
2,030 views
S → aSbS /bSaS / ϵS → aABb A→ c/ ϵ B → d/ ϵWhich of the following is LL1. Explain in details.