Compilation Flashcards

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

What are the 4 stages of compilation?

A
  1. lexical analysis
  2. syntax analysis
  3. code generation
  4. code optimisation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Lexical analysis is…?

A
  • Comments and white spaces removed
  • Remaining code is turned into series of tokens
  • Symbol table is created to keep track of variables and subroutines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Syntax analysis is…?

A
  • Abstract syntax tree is built from tokens produced in the previous stages
  • Errors are generated if any tokens break the rules of the language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Code generation is…?

A
  • Abstracting code tree converted to object code

- Object code is the machine code produced before the final step (linker) is run

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

Code optimisation is…?

A
  • Tweaking the code so it will run as quickly and use as little memory as possible
How well did you know this?
1
Not at all
2
3
4
5
Perfectly