Levels of Programming Language
Machine Code (Low-level)
Binary instructions (0s and 1s) that the CPU can execute directly. Machine code is specific to each CPU architecture. Very fast to run, but difficult to write and understand.
10110000 01100001 ← Machine code (binary)
Assembly Language (Low-level)
Uses mnemonics (short text codes) to represent machine code instructions. Easier to read than binary, but still tied to the specific CPU architecture. Must be converted to machine code by an assembler.
MOV AX, 5 ← Assembly mnemonic
ADD AX, BX
High-level Languages
Written in English-like syntax, close to human language. Portable — can run on different CPUs with the right translator. Examples include Python, Java, C++. Must be converted to machine code by a compiler or interpreter.
total = price + tax ← High-level code
print(total)
| Feature | Low-level (machine/assembly) | High-level |
| Readability | Difficult — binary or mnemonics | Easy — English-like syntax |
| Portability | CPU-specific, not portable | Portable across different hardware |
| Execution speed | Very fast — directly run by CPU | Slower — must be translated first |
| Use case | Device drivers, embedded systems | Most general software |
Translators
A translator converts source code (written by the programmer) into machine code (executable by the CPU).
Assembler
Translates assembly language into machine code. One-to-one translation (each mnemonic → one machine code instruction).
Compiler
- Translates the entire high-level program into machine code before execution
- Output: a standalone executable file (e.g. .exe)
- Advantages: Fast execution; source code hidden from end-user; no translator needed to run
- Disadvantages: Compilation takes time; errors not shown until compilation is complete
Interpreter
- Translates and executes the program one line at a time
- No standalone executable is created — the interpreter must be present each time
- Advantages: Easier debugging (errors shown immediately); useful during development
- Disadvantages: Slower execution than compiled code; source code visible; interpreter needed at runtime
| Feature | Compiler | Interpreter |
| Translation | Whole program at once | One line at a time |
| Speed | Faster at runtime | Slower at runtime |
| Errors | All shown after full compilation | Shown immediately at error line |
| Output | Executable file created | No executable created |
| Needed at runtime? | No — runs independently | Yes — interpreter required |
Integrated Development Environment (IDE)
An IDE is software that provides tools to help write, test and debug programs. IDEs typically include:
- Code editor — with syntax highlighting and auto-complete
- Run/build tools — to compile/interpret and run the program
- Debugger — allows stepping through code line by line, inspecting variables
- Error detection — highlights syntax errors in real time
- Auto-completion — suggests code and fills in keywords
Exam tip: The compiler vs interpreter question is very common. Remember: compiler = whole program at once, produces executable, faster at runtime; interpreter = line by line, no executable, easier to debug. For translators, also know that an assembler converts assembly language specifically.
⚠️ Common Mistakes
- Saying a compiler is "better" than an interpreter — they have different advantages for different situations
- Forgetting that an interpreter must be present every time the program runs
- Confusing assembly language with machine code — they are different; assembly uses mnemonics