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.