Compiler technology icon (to compile an overview of the first chapter)

Compiler technology icon (to compile an overview of the first chapter)

Source -> machine code

Analysis (distal): small portions, attributes identify small portion, comprising: a lexical analysis, syntax analysis, semantic analysis, intermediate code generation

Synthesis of (rear end), comprising: optimization intermediate code, object code generation, code optimization target

1, lexical analysis: recognition, delete the word symbols, lexical checking


Input: source code, output: of binary <word class, word attribute>

2, parsing


Output: abstract syntax tree (AST), from the point of view

3, semantic analysis


 

Limited, mostly type (calculation) Check

4, the intermediate code generation


eg:x=a+b —> t1=a+b x=t1

Why it is divided into two instructions? Because two operations: addition and assignment

5, the symbol table


1) include: name (key) fields and properties (value) domain

2) Implementation: linear form, Hash table

Source -> machine code

Analysis (distal): small portions, attributes identify small portion, comprising: a lexical analysis, syntax analysis, semantic analysis, intermediate code generation

Synthesis of (rear end), comprising: optimization intermediate code, object code generation, code optimization target

1, lexical analysis: recognition, delete the word symbols, lexical checking


Input: source code, output: of binary <word class, word attribute>

2, parsing


Output: abstract syntax tree (AST), from the point of view

3, semantic analysis


 

Limited, mostly type (calculation) Check

4, the intermediate code generation


eg:x=a+b —> t1=a+b x=t1

Why it is divided into two instructions? Because two operations: addition and assignment

5, the symbol table


1) include: name (key) fields and properties (value) domain

2) Implementation: linear form, Hash table

Guess you like

Origin www.cnblogs.com/ggotransfromation/p/11609548.html