4.6.3 Types of program translator Flashcards
Define Translator.
A program which converts code from one computer language to another.
What is the purpose of a translator?
In order for a program to be executed by a computer’s processor, it must be in the form of machine code program.
This means that programs written in assembly language or high-level languages need to be translated into machine code before they can be executed by a computer.
What are the 3 types of program translator?
Assembler
Compiler
Interpreter
Define Assembler.
A translator in low level language, which converts assembly language into machine code.
What relationship does assembly language have with machine code?
It has a 1 to 1 relationship, so that the translation between the two languages is fairly quick and straight forward.
What does it mean: Assemblers are platform specific?
It means that a different assembler must exist for each different type of processor instruction set.
(Because each type of processor has a different instruction set)
Define Compilers.
A translator that converts high level language to machine code (all in one go) and produces an executable file.
What is the process of the compiler?
there are 2 phases:
- analysis phase (1,2,3,4)
- synthesis phase (5,6)
- Lexical analysis - removing white space and comments, replacing key words with tokens.
- Syntactic analysis - tokens are compared against the rules of the programming language. Errors are flagged as syntax errors.
- Semantic analysis - any logic mistakes found in the program are flagged.
- Intermediate Code generation -
- Code Optimisation -
- Code Generation -
Define Interpreter.
Translates high level programming language to machine code and executes line by line.
Define Source Code.
The human-readable code that a programmer writes in a high level programming language.
It is written in a text editor or integrated development environment(IDE) and follows the syntax of a specific programming language.
Define Object Code.
The machine-readable code that is generated from the source code. It is an intermediate form that results from the compilation of source code but before the final executable.
Define Bytecode.
A type of intermediate code that is generated when a program written in a certain high-level language is compiled. Unlike object code, bytecode is designed to be executed by a virtual machine rather than directly by the hardware.