Eliminating epsilon rules

865 Views Asked by At

Hi I have the following CFG

S -> aA | bC | CC
A -> B
B -> S | epsilon
C -> A | S

I have managed to remove the epsilon resulting to:

S -> aA | bC | CC | a | b | C
A -> B
B -> S
C -> A | S

Im in the point of removing unit rules and it resulted in all nonterminals having the same result like:

S -> aA | bC | CC | a | b | C
A -> aA | bC | CC | a | b | C
B -> ...
C -> ...|...

My question is, is my elimination of epsilon correct? Is there anyway of doing it?

0

There are 0 best solutions below