What is Transpiler?
In programming science, Transpiler is a term that refers to tools that read source code written in one programming language and generate the equivalent code of another language. It is also commonly referred to as a "source-to-source converter".
Performance is also one of the reasons to use Transpiler. For example, important parts of the Python codebase can be converted to Fortran and then called from Python. The reason for this is that Fortran has a better compiler that can generate code more optimal.
Some Transpiler tools are made to convert code written in one language into code of the language itself, which seems strange. These tools often convert code written with the old syntax into code with the new syntax (more concise and modern), sometimes the opposite, Babel being one such case.
- Babel la gi?
Transpiler(s) sometimes also include Polyfill(s). A Polyfill is a small piece of code created to simulate an API that is present in the source language, but not in the target language. For example, you use ES6 to write an application and use a function "X" that is available in ES6 but not in ES5, so you need a small piece of ES5 code to simulate the function "X" with the equivalent feature.
Pay attention to the difference between the terms "Transpiler" and "Compiler". The Compiler is used to convert source code written in a high-level programming language (written by humans) into source code of a low-level programming language (machine code) to create executable programs.