Translators Flashcards

(14 cards)

1
Q

What is the purpose of a translator?

A

Changes a program written in one language into another language (usually machine code)

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

What are the 2 main types of translators?

A

Interpreter and compiler

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

How does an interpreter work?

A

Converts high-level language one line at a time into machine code and executes it

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

How does a compiler work?

A

Converts high-level language into machine code for execution at a later time; the entire program is converted at once

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

Describe the execution method of an interpreter

A

Translates source code into machine code one line at a time

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

Describe the execution speed of an interpreter

A

Slower than a compiler: code must be reinterpreted each time the program is run

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

Describe the complexity of an interpreter

A

Smaller, simpler programs

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

Describe the error reporting of an interpreter

A

Interpreter encounters errors and reports it to the user immediately and stops the program from running

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

Describe the repetition of an interpreter

A

Interpreted programs can be edited and run without translating the whole program; interpreters must reinterpret the program every time it is run

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

Describe the execution method of a compiler

A

Translates all the source code into machine code in one go: it produces an executable file that will run on other machines without the compiler needing to be installed

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

Describe the execution speed of a compiler

A

Can produce much more efficient code than interpreters: compiled programs run faster

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

Describe the complexity of compilers

A

Large, complex programs

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

Describe the error reporting of a compiler

A

It would analyse the entire program, taking note of where the errors have occurred and record them in an error file

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

Describe the repetition of a compiler

A

Requires analysis and the generation of the code only once, however compiled programs must be re-compiled after any changes have been made

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