Interpreter Vs Compiler Vs Transpiler

Interpreter Vs Compiler Vs Transpiler

Hi Readers, welcome to my new blogpost. In this post, I'll be talking about what interpreters, compilers and transpilers are, and how they differ from each other.

Similarities between them?

For most comparison, there is bound to be some form of similarities. So the question is, what is the similarity between an interpreter, a compiler and a transpiler?

The similar thing between them is that they all are used to translate source code from one language to another.

Differences between them?

To the main context of the post, what is the difference between these 3 tools that seems to do the same thing.

Compilers

A compiler converts source code written mostly in high level languages to bytecodes or machine codes (different level of abstraction). It converts code which are written to be understood by humans to that which can be understood by a machine. A great example of languages that are compiled is C and C++ using the GCC(GNU Compiler Collection).

Interpreters

An Interpreter converts source code into bytecode and executes it directly line by line. For an Interpreter, the execution of the code is done immediately as it is being converted. A very good example of languages that are Interpreted is Python. Python codes are interpreted rather than being compiled. Examples of Python Interpreters include cPython and PythonNet.

Transpilers

A transpiler converts source code written in a language to another language with the same level of abstraction. The key point here is the level of abstraction. This means that it converts a high level language source code to another high level language source code OR a low level language source code to another low level language source code. An example of a Transpiler is Babel (Converts ES6 Javascript to lower versions of Javascript for browser compatibility). A very good example of transpiration is the conversion of Typescript to Javascript. As they both have the same level of abstraction, transpilers is what is needed.

So I hope you now have a general understanding of the difference between Compilers, Interpreters and Transpilers.

Thank you for reading.