You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers the three types of language translator — compilers, interpreters and assemblers — and the stages of compilation. The OCR H446 specification requires you to understand how each translator works, compare them, and describe the stages of the compilation process.
Computers can only execute machine code (binary). Programmers write code in high-level languages or assembly language, which must be translated into machine code before the CPU can run it.
| Source Language | Translator | Target |
|---|---|---|
| Assembly language | Assembler | Machine code |
| High-level language | Compiler | Machine code (executable file) |
| High-level language | Interpreter | Machine code (executed line by line) |
An assembler translates assembly language into machine code.
| Feature | Detail |
|---|---|
| Input | Assembly language source file |
| Output | Machine code (object file) |
| Translation | One-to-one — each assembly mnemonic maps to exactly one machine code instruction |
| Passes | Most assemblers are two-pass: the first pass builds a symbol table (mapping labels to addresses); the second pass generates machine code using the symbol table |
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.