2.2 Flashcards
(16 cards)
What is a translator?
A program that translates program source code into machine code for execution by a processor
Translators include assemblers for low-level languages and compilers or interpreters for high-level languages.
What is a compiler?
A program that translates high-level languages into machine code all in one go
Compilers are used when a program is finished and has been checked for syntax errors.
What is a key feature of compiled code?
Compiled code can be distributed and run without the need for translation software
It creates an executable file.
What happens if compiled code contains errors?
It must be fixed and then re-compiled
This process is necessary to ensure the code runs correctly.
List two advantages of using a compiler.
- Speed of execution
- Optimises the code
List two disadvantages of using a compiler.
- Can be memory intensive
- Difficult to debug
What is an interpreter?
A program that translates high-level languages into machine code one line at a time
Each line is executed after translation.
What happens if an interpreter finds a syntax error?
The process stops
This allows for immediate debugging.
When are interpreters generally used?
When a program is being written in the development stage
They provide immediate feedback during coding.
List two advantages of using an interpreter.
- Easier to debug
- Requires less RAM to process the code
List two disadvantages of using an interpreter.
- Slower execution
- Every time the program is run it has to be translated
Fill in the blank: Compilers create _______ that can be distributed.
[executables]
Fill in the blank: Interpreted code is more difficult to _______.
[distribute]
True or False: Compiled code is executed as is without the need for translation software.
True
True or False: Interpreters optimise the code during execution.
False
Fill in the blank: A compiler is designed solely for one specific _______.
[processor]