• retagged by
815 views
0 0 votes

S → aA / CB

A → BaA / epsilon

B → bB / Abc / epsilon

C → B

what is follow of C , FOLLOW(C)?

I think answer is FOLLOW (C) = First(B) = { b, first (A),   (dollar for  epsilon) } = {b, a, $}

Am i right?  

Because i found some where FOLLOW(C) = FOLLOW(B) .  Is this statement correct?   (But I think this is wrong)

PLZ confirm the solution of above doubt………………..!!!!!!!!!!!

2 Answers

0 0 votes
FOLLOW(C) will be terminals that can come just after C.

Here FOLLOW(C) = { FIRST(B), FOLLOW(S) }

I wrote FOLLOW(S) because B can be epsilon, thus making S ->aA / C, thus FOLLOW(S) is included in FOLLOW(C)

FIRST (B) will give you {b, FIRST(A)}.. and FIRST(A) is also b,

therefore FOLLOW(C)= {b,$}
0 0 votes
Your answer absolutely right .

look at the production rule S---->CB ,

here FOLLOW(C)=FIRST(B) ,but epsilon is also list of FIRST(B) and when we put epsilon in place of B

rule become just like this S---->C and this gives $ for the FOLLOW(C).

beacuse FOLLOW(C)=FOLLOW(S) & FOLLOW(S)= $
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.0k
1.0k views
manisha11 asked Oct 21, 2018
1,021 views
Can we comment/compare the number of GOTO moves inLALR and CLRCLR and SLR?
0 0 votes
1 1 answer
580
580 views
iamdeepakji asked Oct 10, 2018
580 views
What is actual difference between in LALR(1) and CLR(1).please explain this by taking one example.
0 0 votes
2 2 answers
670
670 views
eyeamgj asked May 16, 2018
670 views
it is confirmed that every LL(1) is LR(1) i.e CLR(1),but i want to know that is every LL(1) grammar is also LALR????? becz LALR is subset of CLR(1).
0 0 votes
1 1 answer
1.0k
1.0k views
shivanisrivarshini asked Mar 10, 2018
1,002 views
Can we have a grammar $G$ which is $LL(1)$ but not $SLR(1)$ ,If so given example grammar