The compiler preprocessor, compiler, assembler, linker.
Precompiled
Processing all comments to spaces instead
All #define delete, and expand all the macro definitions
Processing conditional compilation directives # if, # ifdef, # elif, # else, # endif
Processing #include, to expand the file to be included
#Pragma directive retains the compiler needs to use
gcc preprocessing directives: gcc -E file.c -o file.i
Compile
Pretreatment file parsing, lexical analysis and semantic analysis
Lexical analysis: keywords, identifiers, and other immediate legality
Parsing: Analysis of expression whether to follow the rules of grammar
Semantic Analysis: Further analysis of expression is legitimate on the basis of grammatical analysis
Code optimization corresponding assembly code file generated after analysis
gcc compiler directive: gcc -S file.i -o file.s
compilation
The assembler instructions executable code compiled into machine
Each assembly statement corresponds to a machine instruction almost
gcc -c file.s -o file.o
link
to sum up
Compilation process consists of pretreatment, compile, assemble and link four stages
Pretreatment: annotation processing, macro, and symbols beginning with #
Compile: pretreatment file parsing, lexical analysis and semantic analysis
Assembly: The assembler instructions executable code into the machine