Reputation: 2656
Say I have:
S -> A
A -> B C A a | ϵ
B -> k | ϵ
C -> m
Now in the initial state S' -> S
, I'm going to include:
S' -> .S
Then the closure of S:
A -> .B C A a
, A -> .
Closure would also include B -> .k
and B -> .
obviously.
But since B -> ϵ is a production, would I also have to include C -> ,m
in the initial state? Since in A -> B C A a
, B can be ϵ.
I just wanted to know if I'm right and if this is the right way to deal with epsilons in grammar. If not, do guide me in the right direction. Thanks!
Upvotes: 0
Views: 614
Reputation: 241671
No, C -> . m
is not part of the initial state, because C
cannot be reduced without a preceding B
(even if the B
is reduced from ε
).
Upvotes: 1