search
Log In
0 votes
173 views
S->Aa
A->BD
B->b | ɛ

D->d | ɛ

what is FIRST(S)?
in Compiler Design 173 views

2 Answers

1 vote

FIRST(S) 

Let the set be k={}

FIRST(S) = see first what A is deriving

A -> BD

now see what B is deriving

case 1  : B->b

so A->bD

so k ={b}

case 2 : B-> ɛ

so A->D

now see what D is deriving

case 2.1 : D->d

so A->d

so k ={b,d}

case 2.2 : D-> ɛ

so A-> ɛ

putting A-> ɛ in S

so S->a

so k = {b,d,a}

so FIRST(S)  = {b,d,a}

0 votes
First(S) = {a , b , d}

edited by
0
check about epsilon... It can't be in FIRST(S)
0
Thanks..
0
I've a doubt. Suppose FIRST(A) didn't contain {ɛ}. then FIRST(S) wouldn't contain {a} as well. Am I right?
0
yes

Related questions

0 votes
0 answers
1
117 views
why do first sets can have epsilon symbol but follow sets don’t? P.S: I’ve a silly doubt :P
asked May 12, 2019 in Compiler Design aditi19 117 views
0 votes
3 answers
2
1.4k views
Consider following first order logic $\forall x ( \exists y R( x, y ) )$ is equivalent to 1) $\exists y ( \exists x R( x, y ) )$ 2) $\exists y ( \forall x R( x, y ) )$ 3) $\forall y ( \exists x R( x, y ) )$ 4) $\neg \exists x ( \forall y \neg R(x,y) )$ Note: Not sure in the question was it equivalent to or which of these are implied by
asked Feb 12, 2017 in Mathematical Logic yg92 1.4k views
0 votes
1 answer
3
78 views asked Jun 3, 2019 in Compiler Design Rishabh Baghel 78 views
0 votes
1 answer
4
175 views
Find first and follow of the given grammar? S->AB A->BS/a/€ B->AS/b
asked Jun 3, 2018 in Compiler Design saumya mishra 175 views
...