1.8 Flashcards

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

Lexical Analysis

A
  1. Comments and unneeded spaces are removed
  2. Keywords, constants and identifiers are replaced by tokens
  3. A Symbol Table is created which holds the address of variables, labels and subroutines
  4. Creates new table entries in the symbol table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Syntax Analysis

A
  1. Tokens are checked to see if they match the spelling and grammar expected, using standard language definitions
  2. Parsing each token to determine if it uses the correct syntax for the programming language
  3. If syntax errors are found, error messages are produced./ if no errors are found the compilation process continues
  4. Adds information regarding attribute type, scope, line of reference, etc in the symbol table.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Semantic Analysis

A
  1. Variables (are checked to ensure that they) have been properly declared and used
  2. Variables (are checked to ensure that they) are of the correct data type
  3. Operations are (checked to ensure that they are) legal for the type of variable being used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Code Optimisation

A
  • high-level general programming constructs are replaced by very efficient low-level programming codes

OBJECTIVES
- Achieve the required output of the program
- Not delay the compilation process
- Increase speed of the program
- Decrease resources demand

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

Code Generation

A

Machine code is generated

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

Translator

A

A computer program used to convert a program from one languate to another

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

Compiler

A

Takes the source code of the entire program as input to produce a machine code version of the program which can be run through a single executable file

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

Interperter

A

Takes a single code instruction as input, translates and executes it

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

Compiler Advantages

A
  • Can be re-run without further translation
  • Executes faster than interperated code
  • Machine code can be distributed without compiler being present
  • Machine code is more seccure, cannot be read without a lot of reverse engineering
  • Libraries can be packaged with the executable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Compilers Disadvantages

A
  • Compilers take longer than interperating
  • Errors are only reported after compilation has finished
  • One error may cause many more related errors
  • Recompiling after fixing an error adds time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Interperators Advantages

A
  • Debugging will stop translation at the point where error occurs
  • Complete re-compilation not needed when error found
  • Easier to partially test and debug
  • Can be used during program development
  • Source code is visible and can be checked for security purposes, before being interperated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Interperator Disadvantages

A
  • Associated libraries must be present for the code to run
  • To execute source code the interperator needs to be installed on the running platform
  • Source code needs to be present, making interllectual property harder to protect
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Assembler

A
  • Translates assembly into machine code
  • Each single assembly instruction will translate to one machine code instruction
  • Assembly is easier and less prone to errors than coding in binary
  • Each CPU has own instruction set
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Syntax Error

A

Occurs when a command does not folow the expected syntac of a language

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

Linking Error

A

Calling a standard function where the correct library has not been linked to the program

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

Semantic Error

A

Variable declared illegally

17
Q

Run Time Error

A

An error that only occurs when a program is running and is difficult to foresee beofree it is compiled and run (program compiles successfully but doesnt perform correctly)

18
Q

Logical Error

A

An error that causes a program to output an incorrect answer to what was expected

19
Q

Rounding/ Truncation Error

A

Continued use in further calculations causes inaccuracy