A What is the principle of compiling?
Compiling principle is an important specialized course in computer science, which aims to introduce the general principle and basic method of compiling program construction. The content includes language and grammar, lexical analysis, parsing, grammar-guided translation, intermediate code generation, storage management, code optimization, and target code generation. The compiling principle is an important specialized course of computer professional setup. Although only a few people engaged in the work of compiling, but this course in theory, technology, methods to provide students with systematic and effective training, to improve the quality and ability of software personnel.
This course focuses on the compiler aspects of the production principle and technical problems, it seems that the basic field of computer is not close, but the compilation principle has been as a compulsory course of undergraduate courses, but also become a postgraduate entrance examination must be tested content. Compiler theory and technology is essentially an algorithmic problem, of course, because this problem is very complex, its solution algorithm is relatively complex. We learn the data structure and algorithm analysis is also speaking of algorithms, but the basic algorithm, in other words, the introduction of the algorithm, and the compiler principle of this course is to focus on a more focused solution of an algorithm. In the the 1950s, compiler writing has been considered a very difficult thing, the first Fortran compiler said it took 18 years to complete. While people are trying to write compilers, many theories and techniques related to compiling are born, and these theories and techniques are more valuable than the actual compilers themselves. Like mathematicians in solving the famous Goldbach conjecture, although there is no final solution to the problem, but in the course of the birth of many famous books related to number theory.
Two What are the benefits of learning how to compile?
From a practical point of view, the benefits of the post-compilation rationale (regardless of the fact that there is no final entry) include:
1, it can be easier to understand in a language what is the equivalent of the wording, which is a difference
2, can be more objective to compare the differences between different languages
3, more difficult to be a particular language of the advocates of the flicker
4, learning a new language is more efficient and higher
5, in fact, from language A to language B is a common demand, learn how to compile principles to deal with such requirements will be more skilled
Also, I think this course is a real lesson in the struggle against code, and for a person who has to pursue the technology is not to be missed, and the compiling principle can be said to be a microcosm of computer science. You learn it more is to pursue the nature of the programming language, such as it will be used in register allocation to the greedy algorithm, dead code will be used to eliminate the graph theory algorithm, data flow analysis used in the fixed-point algorithm, Lexical analysis and grammatical analysis of the use of finite state machines and recursive descent such important ideas and so on, perhaps you will not become a compiler developer, but the compilation of the principle of learning to get, what you think is enough to benefit you for life. At the same time, after finishing this course, for a developer who has a geek spirit, he will start to use his own learning to develop and enjoy the "God" feeling, to try to create a language, I think this feeling is not every course can bring you. I believe that when you really complete the process, you have written procedures, programming language will have a deeper understanding of the nature, such a recognition will make you stand very different heights, if you really learn well, I think others see is the grammar, you see is the realization behind,
Three What loss do you have to learn?
Do not learn the principle of compiling, may always give a variety of compiler to the people as slaves, that writing programs can only follow the language philosophy they designed to do. Learn the compiler principle, not necessarily to write their own language, but at least can be a lot of other programmers think cool things to see a bit, will not be the design of programming language to deceive too much.
Four. How to learn the principle of compiling?
1, see a lot of legal texts, court documents, although the natural language text, but there is a certain structure, so want to write procedures to analyze and organize such structures.
2, according to their own summary of the text found in the Rules hand craft analysis procedures.
3, found that this is written out of the smelly and long, and there are some patterns often appear, is a state machine, in a certain state corresponding to apply a rule, and some of the input can also make the state switch. Vaguely feel that there should be some theory already exist for these patterns.
4, at the same time I think these semi-structured text, although not like computer programs have thorough clear rules, but also different from the full prose of natural language text, can it as a grammar rules less strict program source code to see? So, fix it with the stuff from the compilation principle?
5, in the Art of the Unix programming chapter read the introduction of Lexer and Parser section, some understanding, picked up the Dragon book to see the few moments, the most important first four or five chapters to see.
6, in their favorite Python language found a LEX&YACC-type tool ply, play ripe, with it to achieve a automatic resolution in accordance with the legislative law of the 54th format of the legal text of the small procedure. Simple as it may be, it can be useful to convert many plain text bars into a tree structure, which can be used to display these text in a delicate way.
About the compilation principle