2.5.1
Languages
Programming languages exist at different levels. You need to compare high-level and low-level languages, understand why translators are needed, and explain the differences between compilers and interpreters. The key is understanding the trade-offs rather than memorising unnecessary technical detail.
20 exam questions 8 flashcards
What you need to know
- Explain the differences between high-level and low-level languages.
- Explain why translators are needed.
- Compare compilers and interpreters, including benefits and drawbacks.
Big Picture
High-level and low-level languages
Different languages are useful for different reasons.
| Type | Strength | Drawback |
|---|---|---|
| High-level | Easier for humans to read, write, and maintain | Less direct control over hardware |
| Low-level | Closer to machine code and hardware | Harder for humans to read and write |
Machine Code
Why translators are needed
The processor cannot run high-level code directly.
Source code must be translated into machine code so the processor can execute it. That is why translators are needed.
Comparison
Compiler vs interpreter
You may be asked to compare these directly.
| Translator | How it works | Benefit | Drawback |
|---|---|---|---|
| Compiler | Translates the whole program before running | Executable can run again without retranslation | Errors may be reported after the whole translation stage |
| Interpreter | Translates and runs one line at a time | Good for testing and debugging line by line | Program usually runs more slowly |
Not required
Detailed knowledge of assemblers is not required.
Key takeaways
- High-level languages are easier for humans to read and write.
- Low-level languages are closer to machine code and can give more direct hardware control.
- A translator is needed because the CPU only runs machine code.
- A compiler translates the whole program, while an interpreter translates and runs code line by line.
Glossary
- High-level language
- A language designed to be easier for humans to read and write.
- Low-level language
- A language much closer to machine code and hardware.
- Translator
- Software that converts source code into machine code.
- Compiler
- A translator that converts the whole program before it runs.
- Interpreter
- A translator that converts and runs code line by line.
Test yourself
Common questions