Why translate?
The CPU only understands machine code, so source code must be translated.
| Compiler | Interpreter | |
|---|---|---|
| How | translates the whole program once | translates and runs one line at a time |
| Errors | reports them all at the end | stops at the first error |
| Output | an executable file | no file: it runs the source directly |
| Running | fast; no translator needed | slower; the interpreter is needed every time |
| Source code | stays private | must be shared |
| Good for | finished software | writing, testing and learning |
An assembler translates assembly language into machine code, one instruction for one instruction.
Which translator?
Think about who runs the program and what they need.