Translaters
Computers run programs in machine code (binary). Humans program in higher level languages we can understand (more on this here) . To run those high level programs , they need to be converted into machine code. That is what the translaters do.
There are 3 types of translaters:
1) Assemblers - these translate assembly language into machine code. Each CPU has its own assembler as they have their own machine code
2) Compilers - create machine code for the whole program
3) Interpeters - create machine code just for the instruction being run
Both compliers and intepreters turn high level languages into machine code but they do it in different ways:
Compilers | Interpreters |
Translates all the source code (high level code) at the same time | Translates the source code one instruction at a time |
Creates one executable file (exe) | Does not create an executable file |
Returns a list of errors for the entire program, but only shows them once the compiling is finished | Program has to be interpreted every time it is run |
A compiled program runs quickly | Stops as soon as it finds an error (does not show any other errors) |
Compiling can take a long time | Programs run more slowly as they are being translated as they run |
Code only needs to be compiled once (unless there are errors to be fixed). The exe can then be used whenever the program needs to be run |