So, finally, I'll take a look at this. The so-called LR (0) Parse table generation algorithm:
This algorithm at first glance seems to be out of touch with the front, but if you look carefully before the explanation, for example, carefully compare, feel ...
You will find that each time the D actually produces a new state, then look at the specific implementations of closure and Goto:
It is not difficult to find out that closure is the derivation of all the non-terminator (that is, the first non-terminator that is about to be explored) to the right of the left-hand point of all the original derivation, so why do you do this? Because this algorithm is parallel, for example, in the execution of the derivation of the 0, he needs to complete the derivation of the Formula 1, completed after the deduction of 0, then actually he really needs 1, only 1 completed to complete 0, that is, what it really needs is a terminator, This process is the process of constantly simplifying non-terminator to get Terminator ... This is called the closure ... As for Goto, it is the fact that all the transformations in the collection that are capable of x can be obtained as a new state.
Almost like this, in fact, this wave of LR (0) is a bit of a stroke, but a closer look or barely able to understand, or to see the specific code, not the code is just to look at as extracurricular knowledge about ...
Reading dragon Book compiling Principles of Grammar Analysis (12) ...