To Understand the difference between a Transpiler and a Compiler
, we first need to understand what is a compiler and what is a transpiler.
The compiler takes in some code as input and produces a binary executable code aka machine code as output. For example - we use GCC compiler to compile the C/C++ code and it produces the machine code.
Transpilers aka source-to-source compilers read the code in one language and produce the code in another language.
ES6 version:
let a=10;
console.log(a);
ES6 to ES5 (Transpiling):
var a=10;
console.log(a);
For Example, A Transpiler will convert a code from Java to kotlin whereas a Compiler will convert Java into bytecode. Similarly, A Transpiler will convert a code from python to Javascript whereas a Compiler will convert a code from Java to bytecode.
This was my honest try to make you understand the difference better with diagrams as we have a photographic memory and this way it stays long. Do let me know if I need to add more to this and how can I improve more.
Top comments (0)