Interpreter Vs Compiler: The Differences

Maxwel Muraria
3 min readMar 5, 2021

As he slowly sipped his beer, Walter wondered how programmers communicate with computers so efficiently that they understand each other.

If you are like Walter, this article attempts to inform you in the simplest terms possible just how the communication between humans and computers occurs.

Programmers write computer programs in high-level languages. A high-level language is easier for you and me to understand. It contains phrases and syntax that are very similar to the natural language.

This is how a high-level language looks like

Computers do not fathom high-level languages. They only understand machine code which is a binary system consisting of 0s and 1s.

Therefore, a high-level language must be translated to machine code for the computer to understand it.

This is how machine code looks like

Suppose you want to pass a message to a person who does not understand your language. Won’t a translator be heaven-sent? Such are interpreters and compilers to computers.

Interpreters and compilers are programs that translate the high-level language into machine code.

Despite doing a similar job, there are some key differences in how an interpreter and compiler works.

The Differences between Interpreters and Compilers

An interpreter translates a program one line/ statement at a time while a compiler translates the whole program into machine language at a go.

An interpreter analyses code snippets fast. However, the overall program execution time is higher, making it relatively slower. On the other hand, a compiler takes longer to process the entire program, but the overall execution time is less, making it relatively faster.

An interpreter does not generate any intermediary code. As a result, the interpreter is more efficient in memory usage. A compiler generates an intermediary object code which leads to more memory usage.

Interpreters are used by programming languages such as Python and Ruby. Compilers are used by languages such as C and C++.

How an Interpreter and Compiler Work: A Simple Illustration

Compiler

Interpreter

--

--