The Gateway to Computer Science Excellence
0 votes
41 views
S->Aa
A->BD
B->b | ɛ

D->d | ɛ

what is FIRST(S)?
in Compiler Design by Active (5.2k points) | 41 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}

by Active (2.3k points)
0 votes
First(S) = {a , b , d}
by Junior (549 points)
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
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,741 questions
57,251 answers
198,061 comments
104,694 users