Stages of Compilation Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are the four stages of compiling a program

A

Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain the lexical analysis stage

A

Remove white space
Create tokens from the code
Add all the tokens into a symbol table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain the Syntax analysis stage

A

The tokenised code from the lexical analysis is compared to the rules of the programming language.

If a part of the code is found to not fit, an error is generated.

A full error report is given to the user once all of the errors are found.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain the code generation stage

A

Once the code has successfully passed the first two stages, it’s time to generate the code.

Generate object or machine code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the code optimisation stage

A

After the code is generated, it is optimised for efficiency.
The purpose is to make the binary footprint as small as possible and remove procedures and variables that are written into the code, but never used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly