Compiling vs Transpiling

Compiling vs Transpiling

The difference

Compiling is the process of taking source code written in one language and transforming it into another.

Transpiling is the process of taking source code written in one language and transforming it into another language that has a similar level of abstraction.

b.png

Compiling coverts code into lower level executable file (machine code) for computers to execute. As we all know computer doesn't understand code they understand only binary data so, compilers are used to convert higher level of code(human understandable) to the binary file(machine understandable code). Examples of compiled languages are C, C++ and Java which after compiling generates bytecodes or assembly level language which is closer to binary files.

While, Transpiling can be referred as 'source to source' compiler which translates one higher level language to another higher level language. For example, Typescript is higher level language which after transpiling is converted to JavaScript which is also another higher level language. Babel for example can transpile JavaScript ES6 syntax into ES5 syntax to get support from all the older browsers.

End Notes: Hope you like the blog. If you have any suggestions please feel free to comment. Happy Coding! Good Day!