2.4 Programming language translators Flashcards

1
Q

Assembler

A
  • Converts source/assembly code to bytecode (intermediate form)
  • The output is machine code (object code)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Instruction set

A

Machine code instructions that a particular computer can execute

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

Compiler

A
  • Source code as input
  • Performs different checks
  • Converts source code to object code and can be run anywhere without the presence of a compiler
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Interpreter

A

Each line is analysed, translated into machine code and ran one by one if it contains ono syntax errors

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

Bytecode

A
  • Intermediate representation which combines compiling and interpreting
  • Executed by a bytecode interpreter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Advantages of bytecode and JVM

A
  • Platform independence
  • Masks differences between different computer architectures and operating systems
  • Adds extra security layer between the computer and program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Advantages/Disadvantages of compilers

A
  • Object code can be run whenever required without the need to recompile, however if an error is discovered in program has to be recompiled
  • Object code executes faster than interpreted code
  • Object code produced by compiler can be distributed without compiler present
  • Object code is secure and cannot be read without a great deal of ‘reverse engeneering’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Advantages/ Disadvantages of compiler

A
  • Platform interdependence
  • No lengthy recompilation each time an error is discovered
  • Iterations have to be interpreted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Stages of compilation

A
  • Lexical analysis
  • Syntax analysis
  • Code generation
  • Optimisation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Lexical analysis

A
  • Removes superfluous spaces and comments
  • Checks for illegal identifiers
  • Replace keywords with tokens from a symbol table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Syntax and semantic analysis

A
  • Compared to syntax diagrams
  • Parsing
  • Stacks are used to check brackets are correctly paired (reverse Polish notation)
  • Semantic of the program are checked
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Code generation and optimisation

A
  • Aim to reduce the execution time of the object progh
How well did you know this?
1
Not at all
2
3
4
5
Perfectly