Stages of compilation Flashcards
1
Q
What are the 4 stages of compilation?
A
Lexical analysis, Syntax analysis, Code generation, Code optimisation.
2
Q
What is Lexical analysis?
A
1) All white space and comments removed
2) Remaining code is turned into tokens
3) Symbol table is created
3
Q
What is Syntax analysis?
A
Syntax of program is checked against the rules.
Abstract syntax tree created.
If any code breaks the syntax rules errors are generated.
4
Q
What is Code generation?
A
Syntax tree converted into object code.
5
Q
What is Code optimisation?
A
Code is optimised to run as fast as possible.
Involves removing redundant code.