Reading dragon Book compiling Principles of Grammar Analysis (12) ...

Source: Internet
Author: User

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) ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.