What is the difference between Compile and Transpile ?

If you are working with any of the programming languages, you certainly have heard about the term compile. But to be a truth, I have heard the term transpile just before the publishing of this blog post.

As soon as I understand the actual difference between these two terms, I decided to write a post about this.

So, let’s try to understand what is transpile and how is it different from compile.

 

In technical term, the program written in programming language need to be converted in machine language or bytecode in order to be understandable by the computer, which is compiling.

The compiler does that specific task. For e.g, when the source code written in C# is transformed into bytecode, this is compiling because they are at different level of abstraction.

Transpiling is the process of transforming the source code written in one language into another language that has the similar level of abstraction. In this case, the transformed code cannot be changed into machine language or byte-code.

The best example for this is transforming typescript code into JavaScript code. If you have ever work on the angular project, the typescript code later converted into JavaScript code with the help of tsc compiler. The other example includes C++ to C, CoffeeScript to JavaScript etc.

In short, they can be differentiated as below.

Compiling: Converting one form into another form which has the different level of abstraction.

Transpiling: Converting one form into another form which has the similar level of abstraction.

About dipneupane

Dip is a passionate Software Developer based in Kathmandu, Nepal. He chew code and smash keyboard for living. Apart from that, he writes about almost everything on buzzedcode.com.

View all posts by dipneupane →

Leave a Reply

Your email address will not be published. Required fields are marked *