3.6.3.1 Types of Program Translator. Flashcards

1
Q

Define what is meant by a translator.

A

Translates programs written in high-level languages or assembly code into machine code for execution.

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

Outline the types of program translators.

A

Assemblers.
Compilers.
Interpreters.

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

Define an assembler.

A

Translates an assembly language into machine code.

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

Why are assemblers quick and straight forward?

A

Because each assembly

language instruction has a 1-to-1 relationship to a machine code instruction.

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

What is meant by platform specific assemblers?

A

A different assembler must exist for each

different type of processor instruction set.

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

Define a compiler.

A

Translates high-level languages into machine code, all at once.

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

Outline the process of a compiler.

A

Compilers take a high-level program as their source code,

check it for any errors and then translate the entire program at once.

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

What happens to the compiler if there is an error in the code?

A

It will not translate (compile).

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

Outline what happens once code has been translated (compiler).

A

Once translated, a compiled program can be run without the requirement for any other software to be present

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

Why are compilers platform specific?

A

Because they produce machine code.

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

Define an interpreter.

A

Translates high-level languages into machine code, line-by-line.

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

What allows an interpreter to translate each kind of program instruction?

A

Interpreters have procedures that can be used to translate each kind of program instruction.

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

How do interpreters check for errors?

A

As they go, meaning that a program can be partially translated by an interpreter until the error is reached.

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

Why is code translated by an interpreter said to be poorly protected?

A

As when a program is translated, both the program source code and the interpreter must be present. This results in poor protection of the source code
compared to compilers which make the original code difficult to extract.

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

Compare the error checking of compilers and interpreters.

A

Compilers check source code errors line-by-line before translating whereas interpreters begin translation immediately.

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

Compare the translation of compilers and interpreters.

A

Compilers translate entire source code at once whereas interpreters check each line for errors and then translate sequentially.

17
Q

Compare the presence of other software during the execution of both compiler and interpreter.

A

Compilers have no need for source code or compiler to be present when translated code is executed whereas interpreters must have both source code and interpreter present.

18
Q

Compare the protection of code with both interpreter and compiler.

A

Compilers protect the source code from extraction whereas interpreters offer little protection.

19
Q

Define what is meant by an intermediate language.

A

Some compilers don’t produce machine code straight away but instead translate source
code into an intermediate language. Often bytecode.

20
Q

What do intermediate languages allow for?

A

Platform independence.

The interpreter to translate the source code just
once, while still being able to execute the translated code with a variety of different processors.

21
Q

Outline the process of compilers and interpreters.

A

A compiler that uses an intermediate language will translate high-level code into an intermediate language such as bytecode and then use a virtual machine to execute the
bytecode on different processors.

Each different processor instruction set will have its own
virtual machine.

22
Q

Define source code.

A

Source code is the name given to the input to a translator.

23
Q

What would the source code be for an assembler?

A

An assembly language.

24
Q

What would the source code be for a compiler or interpreter?

A

A high-level programming language.

25
Q

Define object code.

A

A translator’s output is called object code and is produced from source code.

26
Q

Where is the object code produced from?

A

The source code.