Language Translators
Language Translators
AS-Level Topic 4.2: Compilers, Interpreters, and Assemblers
1. The Three Main Translators
Computer processors can only execute Machine Code (binary). Translators convert High-Level Languages (HLL) or Low-Level Languages (LLL) into this format.
Translates the entire source code into an executable file (Object Code) in one go.
Example: C++, Rust, Go.
Translates and executes the source code line-by-line. No permanent object code is created.
Example: PHP, Python, JavaScript.
Translates Assembly Language (Mnemonics) directly into Machine Code.
Example: x86 Assembly, LMC.
2. Compiler vs. Interpreter
| Feature | Compiler | Interpreter |
|---|---|---|
| Execution Speed | Very fast (already translated). | Slower (translated while running). |
| Error Reporting | Reports all errors at the end. | Stops immediately at first error. |
| Distribution | User doesn't need source code. | User must have source code. |
| Memory | Uses more memory during translation. | Uses less memory. |
3. Integrated Development Environment (IDE)
An IDE is a software suite that provides all tools a programmer needs in one place.
- Source Code Editor: Features syntax highlighting and auto-indentation.
- Debugger: Allows setting Breakpoints and Stepping through code.
- Auto-Completion: Suggests variables and function names as you type.
- Error Diagnostics: Highlights syntax errors in real-time (squiggly lines).
4. Special Case: Bytecode
Some languages (like Java) use a hybrid approach. They compile source code into Bytecode, which is then interpreted by a Virtual Machine. This makes the code "Platform Independent"—write once, run anywhere.