Translator(Compilers, Interpreters and Assemblers) Flashcards

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

What is a translator?

A

A program that converts code from one language into equivalent code written in another

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

What does an assembler translate?

A

Assembly to machine

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

How does an assembler work?

A

Uses the processor’s instruction set to convert the instructions to the machine code equivalent(Produces an object file)
Optimisation will occur, E.G substituting subprogram calls as if they were inline, calculating values of constants etc

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

What does an Compiler translate?

A

High-Level to machine

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

how does a compiler work?

A

A compiler scans through the whole code, and translates it all into machine code
A compiled program can be directly executed(a binary file is produced)
After translation, the compiler and source code are no longer needed
- You can distribute your program without the source code
Error messages are only shown after scanning whole code
- Can be awkward and time-consuming for debugging

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

What does an Interpreter translate?

A

High-Level to machine

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

How does a Interpreter work?

A

Work Line-by-line –> translates a line =, then immediately executes it
Everytime you want to execute code, it must be translated again
Stops as soon as it reaches an error
Both the interpreter and the source code are needed at all times
Slower than a compiler

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