edited by
322 views
1 votes
1 votes
S -> AB | BAB

A -> SA | ba

B -> a | $\epsilon$

What are the follow of S, A, B?
edited by

1 Answer

Best answer
3 votes
3 votes

To find Follow, we have to find First first

First are the terminals that a variable can have including ϵ

First of S = {a,b,ϵ}

First of A = {a,b,ϵ}

First of B = {a,ϵ}

Now, we find the follow. Follow means "what are the terminals that could follow a variable in the process of derivation". In Follow, ϵ is not allowed. Follow of start symbol is always $  but not limited to $(reference symbol).

Follow of S = {$,a,b} = First of A, Follow of A , First of B

Follow of A = {$,a,b} = First of B, Follow of S

Follow of B = {$,a,b} = First of A, Follow of A

selected by

Related questions

0 votes
0 votes
1 answer
1
Sajal Mallick asked Oct 13, 2023
164 views
Does Follow and First operation always apply on non left recursive grammar?
0 votes
0 votes
1 answer
2
aditi19 asked Jun 8, 2019
476 views
X->aABeB->c | dA->aWhat will be the follow of A here?{c, d, $} or {c, d, e, dollar}
0 votes
0 votes
1 answer
3
1 votes
1 votes
0 answers
4
aditi19 asked May 12, 2019
1,691 views
why do first sets can have epsilon symbol but follow sets don’t?P.S: I’ve a silly doubt :P