retagged by
395 views
0 votes
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………………..!!!!!!!!!!!

retagged by

2 Answers

0 votes
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 votes
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)= $

Related questions

0 votes
0 votes
1 answer
1
manisha11 asked Oct 21, 2018
426 views
Can we comment/compare the number of GOTO moves inLALR and CLRCLR and SLR?
0 votes
0 votes
1 answer
2
iamdeepakji asked Oct 10, 2018
305 views
What is actual difference between in LALR(1) and CLR(1).please explain this by taking one example.
0 votes
0 votes
2 answers
3
eyeamgj asked May 16, 2018
309 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 votes
0 votes
1 answer
4
shivanisrivarshini asked Mar 10, 2018
589 views
Can we have a grammar $G$ which is $LL(1)$ but not $SLR(1)$ ,If so given example grammar