I was reading the LR() parsers from the Dragon Book where I came across these lines:
To construct canonical LR(0) collection for a grammar, we define an augmented grammar and 2 functions, CLOSURE and GOTO.
for example say if we have a grammar like-->
S → BB
B → cB/d
Then in augmented grammar we define it as
S' → S
S → BB
B → cB/d
In the dragon book the reason for this is mentioned as,
The purpose of this new starting state production is to indicate the parser when it should stop parsing and announce the acceptance of the input. That is acceptance occurs when only when the parser is about to reduce S' → S
I am unable to understand what this even means and how this augmented grammar is useful for parsing. Any help will be highly appreciated.