A transpiler is a source to source type of compiler that translates the source code of a program in one programming language into another programming language which works on approximately same level of abstraction. TypeScript, Babel, or Traceur are some of the transpilers available.
Purpose of source to source compiling is translating legacy code of the programming language to use its next version. Transcompilers may change the structure of the original code so much, that the translated code does not look like the source code, or else they may either keep translated code as close to the source code as possible to ease development and debugging of the original source code.
History of Transcompilers:
In 1981, a program written by Gary Kildall, which translated .ASM source code for the Intel 8080 processor into .A86 source code for the Intel 8086. Later, a similar, but much less sophisticated program was TRANS.COM, written by Tim Paterson in 1980 as part of 86-DOS. It could translate some Z80 assembly source code into .ASM source code for the 8086, but it supported only a subset of opcodes, registers and modes, often still requiring significant manual correction and rework afterwards. Also it did not carry out any register and jump optimizations.
Transpiler is a type of compiler but what is the difference between a transpiler and a compiler?
A transpiler translates between languages that work on approximately same level of abstraction, whereas, compiler translates languages at a wide range of level of abstraction. A compiler translated a high level language into a low level language. That is the major difference between compilers and transpilers.
What are the applications of Transpiling?
Transpilers may be used for the purpose of data migration, data conversion, and program transformation in various fields. Mainly it allows the access to next version of a language by converting from one version to another.
It is used in macro processing, Pre-processing, data warehouse, and software engineering fields.