Program construction Flashcards

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

assembler

A

translates code from low level assembly language to machine code
once assembled program file can be re-used without assembly

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

interpreter

A

reads, translates and executes one line at a time from high level language program

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

interpreter pros

A

will stop when comes across a line with an error which makes debugging easier

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

interpreter cons

A

doesn’t produce executable file so must be re-translated each run - slower overall
relevant interpreter to source code must be installed

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

compiler

A

translates code from high level to machine all at once then executes used by C++

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

compiler pros

A

slow for first run though due to translation but produces executable file that means only needs to be translated once

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

compiler cons

A

can produce multiple errors at same time so hard to debug
if needs to run on diff platform it will need to be recompiled to be targeted at required platformst

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

stages of the compilation process

A

lexical analysis
syntax analysis
semantic analysis
code generation and optimiser

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

lexical analysis

A

comments and unneeded spaces are removed
converts source code into token stream and puts them into the symbol table
keywords, constants and identifiers become tokens (usually hex numbers) in the table

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

syntax analysis

A

the tokens are checked to see if they match the expected spelling and grammar
done by parsing each token to determine if it uses the correct syntax for the language
produces error message if syntax error found

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

semantic analysis

A

variables checked to ensure:
they have been properly declared and used + they are of the correct data type
operations checked to ensure they are legal for data type being used

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

code generation

A

code specific to target machine is generated
several lines of machine code for each high level instruction

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

code optimisation

A

replacement of inefficient code done by compilers to increase speed of the program, decrease demand on resources while still achieving desired output and not delaying overall compilation process

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