• edited by
659 views

2 Answers

Best answer
2 2 votes
Given Grammar -
S → A
A → AB|ϵ
B → aB|b

The first of -
first(B) = {a, b}
first(A) = {ϵ, a, b}
first(S) = first(A) = {ϵ, a, b}

The follows of -
follow(S) = {$} as S is the Starting Symbol
follow(A) = follow(S) U first(B) = {$, a, b}
follow(B) = follow(A) = {$, a, b}
• edited by
Position:
Show:

Related questions

0 0 votes
1 1 answer
3.6k
3.6k views
Subhrangsu asked Apr 15, 2022
3,603 views
Compute FIRST and FOLLOW sets:S→ aAC | bBA→ Abc| Abd | eB→ f | gC→ h | i
1 1 vote
0 0 answers
2.5k
2.5k views
aditi19 asked May 12, 2019
2,545 views
why do first sets can have epsilon symbol but follow sets don’t?P.S: I’ve a silly doubt :P
2 2 votes
1 1 answer
5.0k
5.0k views
saumya mishra asked Jun 3, 2018
4,994 views
Find first and follow of the given grammar?S->ABA->BS/a/€B->AS/b
2 2 votes
2 answers 2 answers
2.1k
2.1k views
Abhishek Malik asked Apr 5, 2018
2,120 views
Find First and Follow in the following grammar.$E\rightarrow E+T \mid T$$T\rightarrow TF \mid F$$F\rightarrow F^* \mid a \mid b$