Classification of programming languages and translators
High-level vs low-level languages
Programming languages exist on a spectrum from machine code (the lowest level) up to high-level languages like Python.
Machine code (lowest level)
- Instructions are binary numbers (0s and 1s) that the CPU executes directly
- Specific to one processor family — x86 code won't run on ARM
- Extremely fast — no translation needed at runtime
- Virtually unreadable by humans:
10110000 01100001 ; move the value 97 into register AL
Assembly language
- Uses mnemonics (short words) instead of raw binary
- One mnemonic corresponds to one machine-code instruction
- Still processor-specific (low-level)
- Used in device drivers, embedded systems and performance-critical code:
MOV AL, 97 ; move 97 into register AL
ADD AL, BL ; add register BL to AL
High-level languages
- Use English-like syntax, maths notation and named variables
- Portable — the same code can run on different hardware (after translation)
- One line often compiles to many machine-code instructions
- Examples: Python, Java, C#, JavaScript
score = score + bonus # Python — one readable assignment
Why use each level?
| Level | Advantages | Disadvantages |
|---|---|---|
| Machine code | Fastest execution; direct hardware access | Unreadable; not portable; very slow to write |
| Assembly | Close to hardware; readable mnemonics | Still processor-specific; complex |
| High-level | Readable; portable; faster to write; libraries available | Slower than machine code; less direct hardware control |
Translators
A translator converts source code written in one language into another form that the computer can execute.
Assembler
- Translates assembly language → machine code
- Simple 1-to-1 translation (one mnemonic → one instruction)
Compiler
- Translates a high-level language → machine code all at once, before execution
- Produces a standalone executable file
- Advantages: Fast execution (no translation at runtime); executable can be distributed without the source code; errors caught at compile time
- Disadvantages: Must recompile after any change; compiled file is platform-specific
Interpreter
- Translates and executes a high-level language one line at a time, at runtime
- Does NOT produce a standalone executable
- Advantages: Easier to debug (errors reported line by line); code can be run on any machine that has the interpreter installed; good for development/scripting
- Disadvantages: Slower at runtime (translating happens every time the program runs); source code must be present to run
Compiled vs interpreted — quick comparison
| Feature | Compiler | Interpreter |
|---|---|---|
| Translation time | Before running (once) | During running (every time) |
| Speed of execution | Fast | Slower |
| Error reporting | All errors at once | Stops at first error |
| Distributable? | Yes (binary) | Source code needed |
| Debugging | Harder (batch errors) | Easier (line-by-line) |
Python uses an interpreter; C uses a compiler. Some languages (Java, C#) use both — compiled to bytecode, then interpreted/JIT-compiled by a virtual machine.
Exam tip
The most common question asks you to compare compiler and interpreter or explain why a developer might prefer one. Remember: compilers are faster at runtime; interpreters are easier to debug during development.
AI-generated · claude-opus-4-7 · v3-deep-computer-science