search
Log In
0 votes
156 views
why do first sets can have epsilon symbol but follow sets don’t?

P.S: I’ve a silly doubt :P
in Compiler Design 156 views
0
It is the rule. If the follow set has epsilon, then we have to remove it, with certain rules of Compiler. I think u know those rules.
0
I know the rule. but what may happen if follow set has epsilon
1
Follow set can never  contain $\epsilon$ entry. If u derive derive FOLLOW set property, then u can found out, why it cannot contain.
First of all, where we use a FOLLOW set??

When there is a $\epsilon$ entry in FIRST set of LL(1) entry, there we use follow set.
Now, if this NON-TERMINAL doesnot follow by anything, then what do we do?

We just go to that NON-TERMINAL from where it derived, and check it's FOLLOW set

If nothing found , then go from where derived

And , at last if nothing found it returns dolor

$S\rightarrow aS|aA$

$A\rightarrow bB|\epsilon $

$B\rightarrow b$

Now, FIRST of $A$ contains $\epsilon$, and $A$ doesnot FOLLOW by anything,

So, go for FOLLOW of S

Now, FOLLOW of S contains nothing but dolor.

So, $\epsilon$ never possible.
1
got it. nice explaination

Please log in or register to answer this question.

Related questions

0 votes
1 answer
1
148 views
X->aABe B->c | d A->a What will be the follow of A here? {c, d, $} or {c, d, e, dollar}
asked Jun 8, 2019 in Compiler Design aditi19 148 views
3 votes
3 answers
2
470 views
is it correct?
asked Aug 19, 2017 in Compiler Design Pranav Madhani 470 views
4 votes
2 answers
3
1 vote
1 answer
4
299 views
Consider the following grammar S --> Ka|bKc|dc|bda K ---> d The grammar is not LALR(1) SLR(1) LR(1) none of the above
asked Dec 13, 2018 in Compiler Design rahuljai 299 views
...