* This semester, the compiling principle of this course, I will ask such questions
- The textbook introduces lexical analyzer, parser, and semantic parser, so what role does this play in a mature compiler?
- Daily, I contact the most compiler is GCC, clang (of course, there are VB and so on), what are their differences? How to choose?
- Based on GCC, how to design your own language (or look at a computer language from the compiler's perspective), how to quickly follow the compilation tool chain?
- A new processor was introduced, how to solve the platform for its rapid generation of the compiler tools?
The summary is understood as follows:
The overall framework of a modern compiler
With the development of hardware and language, the compiler also tends to stabilize the structure of the compiler.
GCC clang
* In this note: The compiler section of the following compiler is discussed, and the compiler assembly and links section is not discussed.
Clang
Independent front-end + LLVM
The advantage is LLVM (compiler back end)
Gcc
Independent front-end + stand-alone background
(Advantage is front end, support multi-lingual front-end processing)
The middle code is RTL
When I know that their advantages are in front end and back end, I think there is no one is their comprehensive compiler, rely on, really have
llvm-gcc
The purpose of the birth is really to combine the advantages of both, but why this compiler is not the first two famous?
The original is with clang constantly iterative update, its front-end is very powerful, so LLVM-GCC is lonely
The strength of maintenance is diminishing.
* The compilation process of these two compilers, to their official website will be described in detail
Solve doubts
The first two questions are no longer stated
For the latter two questions, think about the answer:
I'm going to develop a new language myself, and then add my own grammar, but I don't have enough energy to fully design a compiler (or I want to do it the quickest) one of the ways is based on the two main compilers above, only the compiler front end, the compiler front end has two well-known tools, Lac and YACC , with them, we do not have to do the manual lexical and grammatical analysis of the work (manual refers to the implementation of the lexical and parser).
However, the use of these two tools also has a large number of deficiencies
The new processor is pushed out, then the processor vendor provides its processor compilation support to get the assembler code for the platform, so each processor vendor will have a compiler team (very core)
Compiler common Sense