Transpilers And Compiler
Transpilers (or Source-to-Source Compilers) :
Transpilers, or Source-to-Source Compilers, are Tools that Read Source Code Written in One Programming Language and Produce the Equivalent Code in Another Language. with a Similar Level of Abstraction. Abstraction means showing Essential Features and Hiding Background Details. For Example: Babel Transpiler can also be used for Converting the ES6 JS Code to ES5 JS Source Code.
We use Transpiler because JavaScript is Fast Growing, there will always be a Difference between the latest code we can write and What Browser Engines support. So, As developers, We should focus on Writing clean with newer syntax that Communicates the Ideas Effectively and Let the Tools Take Care of the Compatibility.
Es6 Code :
[1,2,3,4,5].map(n=>n*2)
Transpilier Converts it to Simple Es5 Code :
"use strict";
[1, 2, 3, 4, 5].map(function (n) {
return n * 2;
});
Compilers :
Compiler, Compiles (Translate) Source Code into a set of Machine-Language Instructions that can be Understood by a CPU. Compilers also Convert the Code from one Language to other Language but Both Languages are very Different in Abstraction Level.
For Example, Java Compiler Converts the
.java file to .class file
For now, This is it from My side :)
Happy Coding :P