retagged by
1,612 views

3 Answers

0 0 votes
S → bA | aB

A → AaS | BcA | a

B → bS | ε

FIRST (S) = FIRST(bA) U FIRST (aB)

                = {b,a}
 

FIRST (A) = FIRST(AaS)  U  FIRST(BcA) U  FIRST(a)   ------------ {FIRST(AaS) We will not consider this beacuse of recurssion}

                  = FIRST(B)-{ε}  U {a}

                  ={b,ε}-{ε}  U {a}

FIRST (A) = {b, a}

FOLLOW(A) = {a}  U  FOLLOW (A) U FOLLOW(S)

                     ={ a, $}

FOLLOW(B) = {c} U FOLLOW(S)

                                    S → aB

FOLLOW(B) ={$,c}

FOLLOW (S) = {$} U FOLLOW(S) U FOLLOW(S)

                                    A → AaS             B → bS

                       ={$} U FOLLOW(A) U FOLLOW(B)

                       ={$} U { a, $} U {$,c}
FOLLOW (S)  = { $, a, c}
0 0 votes
First(A) = {a,b,c}

Follow(B) = { $,c, a}
edited by
Position:
Show:

Related questions

2 2 votes
1 1 answer
652
652 views
Sadique Ul Malik asked Nov 20, 2017
652 views
S aA | CBA BaA | ϵB bB | Abc | ϵC BWhat will be first(B)?
3 3 votes
2 2 answers
869
869 views
1 1 vote
1 1 answer
2.3k
2.3k views
vinay chauhan asked Dec 30, 2018
2,282 views
Consider the following grammar G shown Below :S → abS | ScS | d | cThe number of terminals in follow set of non-terminal S is ___________________ Is “$” symbol considered...
0 0 votes
1 1 answer
484
484 views
ykaran12x asked Sep 22, 2024
484 views
Which of the following are present in FIRST(S) ∩ FIRST(F)?S → EE → Ff | GhF → ef | Gh | ϵG → Gg | ϵ A) {e, f, g, h} B). {e, f, h, ϵ}C). {e, g, h, ϵ}D). {...