Topic 4 · Software
Programming languages, translators, and IDEs
High-level and low-level languages, assembly, compilers versus interpreters, and the tools an IDE gives you.
High-level and low-level languages
A CPU can only run machine code: binary instructions from its instruction set. People write programs in languages that are easier to understand, and those programs must be translated.
| High-level | Low-level | |
|---|---|---|
| Examples | Python, Java, Visual Basic, pseudocode | Assembly language, machine code |
| Readability | Close to English, easy to read and debug | Hard to read; uses mnemonics or binary |
| Portability | Runs on different CPUs once translated for each | Written for one type of CPU |
| Control | Hardware details are hidden | Direct control of memory and registers |
| Used for | Most programs | Device drivers, embedded systems, speed-critical code |
Assembly language
Assembly language uses short mnemonics such as LDA, ADD, and STO instead of binary. Each mnemonic matches one machine code instruction. An assembler translates assembly into machine code.
LDA 0110 ; load the value at address 0110 ADD 0111 ; add the value at address 0111 STO 0112 ; store the result at address 0112
Compilers and interpreters
High-level code is translated by a compiler or an interpreter.
| Compiler | Interpreter | |
|---|---|---|
| How | Translates the whole program in one go into an executable file | Translates and runs one line at a time |
| Errors | Reports all errors after trying to compile the whole program | Stops at the first error it finds |
| Running again | The executable runs without the compiler, quickly | Needs the interpreter every time, slower |
| Source code | Not needed to run, so it can be kept private | Must be supplied to run |
| Best for | Distributing a finished program | Writing and debugging a program |
Exam tip. PseudoEditor's compiler checks your whole program and lists every error with its line number before anything runs.
Integrated development environments (IDEs)
An IDE is a single program with the tools a programmer needs:
- Code editor with features such as syntax highlighting, auto-completion, auto-indentation, and prettyprint.
- Run-time environment to run and test the program.
- Translator: a built-in compiler or interpreter.
- Error diagnostics that show where errors are and suggest fixes.
- Debugging tools such as breakpoints, stepping line by line, and watching variable values.
Key terms
- Machine code
- Binary instructions a CPU can execute directly.
- Assembler
- Translates assembly language into machine code.
- Compiler
- Translates a whole high-level program into machine code at once.
- Interpreter
- Translates and executes a high-level program one line at a time.
- IDE
- Integrated development environment: software with tools for writing and testing code.
Check yourself
Give two reasons to write a program in a high-level language.Show answer
It is easier to read, write, and debug, and it is portable between different types of computer.
Why might a developer use an interpreter while writing a program?Show answer
It stops at the first error and shows where it is, so errors can be found and fixed one at a time, and the program can be tested without compiling it all.
Why might a company distribute a compiled program instead of its source code?Show answer
The executable runs without a translator and the source code stays private, so it cannot easily be copied or changed.