The Function and Purpose of Translators Flashcards
Define assembly language.
A low level language that uses mnemonics and labels to represent a full set of instructions.
What is the assembler?
A piece of software that translates assembly language into machine code.
The assembler must be machine specific.
Define high level language.
A high level language written as source code. It is understandable by the programmer often using keywords to represent instructions.
Define machine code.
- binary notation/executable form
- set of all instructions available
- (instructions operate on) bytes of data
- dependent on architecture/processor design
What is an interpreter?
A translator program that translates source code one line at a time into machine code.
What is an interpreter useful for and why?
Debugging and testing as it returns accurate error messages as they arrive.
What is a compiler?
A translator program that translates the source code as a unit into machine code to produce an executable program file.
What is the purpose of intermediate code?
- It can run on a variety of machines using an interpreter
- Improves portability
- Allows sections of programs to be written in different languages
- Used in a virtual machine
What additional software is needed to run the intermediate code?
An interpreter/ Virtual Machine
What is the main purpose of a translator?
- To translate source code into object code
- To detect and report any errors
What are the disadvantages of using intermediate code?
- program runs more slowly
- has to be translated each time program is run
- needs additional software
What does optimisation do?
- make code as efficient as possible
- increases processing speed
- reduces the number of instructions
What are the features of an interpreter?
- translates one line at a time
- runs each line before translation of next
- reports one error at a time and then stops
- indicates the position of the error
What are the disadvantages of using an interpreter?
- Program runs more slowly due to translation each time
- Additional software is needed every time the program is run
What are the advantages of using a compiler?
- Protects programs from malicious use
- Optimisation improves program speed
- Compiler is no longer needed once executable file is produced.