Computers can execute programs that are written in a strictly defined computer language. You cannot write a program using a natural language such as English or Greek, because your computer won’t understand you!

But what does a computer actually understand? A computer can understand a specific low-level language called the “machine language.” In a machine language all statements (or commands) are made up of zeros and ones. The following is an example of a program written in a machine language, that calculates the sum of two numbers.

0010 0001 0000 0100
0001 0001 0000 0101
0011 0001 0000 0110
0111 0000 0000 0001

Shocked? Don’t worry, you are not going to write programs this way. Hopefully, no one writes computer programs this way anymore. Nowadays, all programmers write their programs in a high-level language and then they use a special program to translate them into a machine language. There are two types of programs that programmers use to perform translation: compilers and interpreters.

A compiler is a program that translates statements written in a high-level language into a separate machine language program. The machine language program can then be executed any time you wish. After the translation, the compiler is no longer required. C++ is an example of a high-level language that uses a compiler.

An interpreter is a program that simultaneously translates and executes the statements written in a high-level language. As the interpreter reads each individual statement in the program, it translates it into a machine language code and then directly executes it. This process is repeated for every statement in the program. PHP is an example of a high-level language that usually uses an interpreter.