Stages of compilation Flashcards

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

Lexical analysis

A
  • comments and unneeded spaces are removed
  • keywords, constants and identifiers are replaced by ‘tokens’
  • a symbol table is created which holds the addresses of variables, labels and
    subroutines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Syntax analysis

A

tokens are checked to see if they match the spelling and grammar expected, using
standard language definitions. This is done by parsing each token to determine if it
uses the correct syntax for the programming language
* if syntax errors are found, error messages are produced

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

Semantic analysis

A

variables are checked to ensure they have been properly declared and used
* variables are checked to ensure they are of the correct data type, e.g. real values
are not being assigned to integers

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

Code generation

A
  • machine code is generated
  • code optimisation may be employed to make it more efficient/faster/less resource
    intense.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly