Compiler VS Interpreter in simple . . .

Moath Obeidat
2 min readApr 2, 2021

Compilers and interpreters are programs that help convert the high-level language (Source Code) into machine codes (binary systems) to be understood by the computers. A high-level language is one that can be understood by humans. low-level language is one that is represented in 0 or 1 forms, which are the machine instructions.
the hight level language contains words and phrases from the languages in common use. so, computers cannot understand high-level languages. They can only understand the binary systems ( machine code). programs are usually written in a high-level language. and they must be converted into machine language. so compilers and interpreters will do the conversion job but in different ways.

Interpreter way

1- translates just one statement of the program (line by line)at a time into machine code.

2- takes a very short time to analyze that statement. but ! the overall time to execute the process will be slow, but this thing has an advantage in the next point.

3- if any error is caught, the interpreter stops working, so debugging becomes easy.

4- The interpreter never generates any intermediate machine code, so no memory is needed.

5- language that uses interpreter (PHP, Python, javaScript).

Compiler way

1- scans the entire program and translates it, into machine code at once.

2- takes much time to analyze the program. but ! the overall time to execute the process will be fast because the whole program is translated to machine code no just a line.

3- the error messages will be generated only after the compilation is finish, and this makes the debugging harder.

4-The compiler always generates an intermediary object code. this means more memory is needed.

5- language that uses interpreter (Java, C#, C++).

--

--