A compiler is a type of translator. It takes the complete source code and converts it all to machine code before the program is executed. The result is an executable file. Once it has been compiled, the executable can be started as many times as you like; it does not need to be translated again, and neither the source code nor the compiler has to be there.

What the executable gives you
If you compile a quiz game on one Windows laptop, you can copy the executable to another Windows laptop and play it there without installing the compiler or handing over your code.
Benefits
- A compiled program is fast to start and run, since the translation work was completed earlier. The program only has to be translated once.
- You can give the executable to users without the source code, so your code stays private and cannot easily be copied or modified, and users do not need the translator.
- A compiler can also optimise the code while it translates, for example by removing instructions that have no effect or choosing a faster machine instruction, so the executable may run faster or use less memory.
Drawbacks
- Compiling a large program can take a long time, and after every change you must compile the program again before you can test the new version.
- A compiler attempts to translate the whole program and then reports all errors together. The program cannot run until every syntax error is fixed, and because the errors are all reported at the end, they can be harder to locate.
- An executable is produced for one type of computer or platform only. For example, an executable made for a Windows laptop will not run on an Apple Mac; the source code must be compiled for that platform instead.