I'm trying to learn compiler construction and I just read through the Dragon Book chapter on SLR parsers. So, I decided to make a simple grammar and try to hand code the parser. The grammar looks like this:
S -> A
A -> (A)A
A -> e,
where e
is the empty string production.
According to another question on StackOverflow, the items in the starting state should look like
S -> .A
A -> .(A)A
A -> .e,
but what would the GOTO functions look like. I know that GOTO( '(' ) = *some state with A -> (.A)A*
, but I cannot really wrap my head around GOTO(e)
. It does not really make sense for a parser to see an empty string. Does it?
Thank you all in advance!
Michael