The Gateway to Computer Science Excellence
0 votes
why do first sets can have epsilon symbol but follow sets don’t?

P.S: I’ve a silly doubt :P
in Compiler Design by Active (5.2k points) | 68 views
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.
I know the rule. but what may happen if follow set has epsilon
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.
got it. nice explaination

Please log in or register to answer this question.

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,737 questions
57,317 answers
105,107 users