Stages of comilation 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

What is lexical analysis?

A
  • All white space removed
  • Remaining code is turned into tokens
  • Symbol table is created
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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 generated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is code generation?

A
  • Syntax tree converted into object code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is code optimisation?

A
  • Code optimised to run as fast as possible

- Involves removing redundant code

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