Let's suppose I have the following grammar:
S → X
X → a | ϵ
If that grammar wouldn't have ϵ
involved, I would construct the first state like:
S' → .S
S → .X
X → .a
but what about the ϵ
symbol? Should I include:
X → .ϵ
too?
If so... when creating the next states... should I do GOTO(Io,ϵ)
, being Io that first state?
I agree with Howard. Your state in the DFA should contain the item: x → .
Here's a DFA I drew for an SLR(1) parser that recognizes a grammar that uses two epsilon productions: