programming language translators Flashcards

1
Q

Translating assembly code

A

Assembly language is translated into machine code by a program called an assembler​

Typically, one assembly code instruction is translated into one machine code instruction​

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

Source code

A

The assembly code program is the input to the assembler​

This is known as the source code​

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

object code​

A

The output is the machine code instructions produced by the assembler, called the object code​

The object code can be saved and run whenever needed​

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

Uses of assembly code​

A

Assembly code is used when a program needs to execute as fast as possible, occupy as little space as possible or manipulate individual bits and bytes​

Typical uses include embedded systems, real-time systems, sensors, mobile phones, device drivers and interrupt handler​

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

Compilers​

A

A compiler is a program that translates a high-level language such as Visual Basic or Delphi into object code​

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

The compilation process​

A

A compiler is a complex program which has several phases
lexical
syntactic
semantic
It produces intermediate code, optimises it, then generates the machine code​

It will not generate the machine code it there are any errors in the program​

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

Errors detected by the compiler​

A

The compiler will find errors such as syntax errors or missing subroutines​

When all errors of this kind have been corrected, the compiler will produce relocatable code, since it does not know the absolute addresses where the object code will be loaded​

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

Advantages of a compiler​

A

Once a program has been compiled, the object code can be distributed and the compiler is not needed to run the program​

The object code runs faster than interpreted code​

The object code is more secure, as machine code cannot easily be read and copied by someone wishing to modify the code and sell it as their own product​

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

interpreters​

A

The third type of translator is an interpreter​

An interpreter translates high-level instructions into an intermediate form, which it then executes​

No object code is produced​

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

Advantages of an interpreter

A

An interpreter is useful in education

It is useful during development when a programmer may want to test a small piece of code

Both compilers and interpreters are available for most high-level languages​

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

Bytecode​

A

Some compilers such as the Java compiler compile the source code into an intermediate form known as bytecode​

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