Compiler Introduction: Overview, compiler Overview

Source: Internet
Author: User

Compiler Introduction: Overview, compiler Overview

First of all, I declare that this series of blog posts is a record in the process of learning compilation principles. The main reference book is Allen I Holub's Compiler design in C.

First of all, I would like to express my gratitude to the author of this book, such as the dragon book, the tiger book, and the whale book. The basic book is too advanced. You can also read and understand the core ideas, but there is still a distance from writing the actual code by myself. I think it is really meaningful to write the code by myself, so I will rewrite the Code with the book (the original book is the C version, I tried to change to the Java version by myself) and split the overall structure of the compiler in order to sort out clear lines so that I can really understand and recall them later. The above is my original intention.

According to the organizational structure of the original book, it is also divided into lexical analyzer generator (LEX) and syntax analyzer generator (YACC). First, put a structure map of the recently combed lexical analyzer, it will be further explored in the future.

The figure is drawn using the Mind Map freeplane. It is too big. Let's look at it in a few pieces.

 

Figure 1 Overall graph of lexical analyzer

Figure 2 input buffer Structure

Figure 3 structure of lexical analyzer Generator

Figure 4 uncertain finite automaton Structure

 

Figure 5 finite automaton Structure

Figure 6 analyzer generation

 

Figure 7 Template File

The code for the current project is attached:

Compiler generator Compiler: https://github.com/9527hello/Compiler

C compiler CCompiler: https://github.com/9527hello/CCompiler

Related Article

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.