In this blog we will discuss about the differences between compiler & Transpiler in Type script .

Compiler :

A compiler is any programme that takes source code written in one language and converts it into output code written in another language, usually with a lower level of abstraction. In practise, compilers convert code written in high-level programming languages, which have a higher level of abstraction to the machine but are more readable to humans, into assembly language, which has a low level of abstraction to the machine and is easily convertible to binary machine codes but has little human comprehensibility.

Transpiler :

Transpilers can also translate source code written in one language into output code written in another language with a comparable level of abstraction. Source-to-source converters are transpilers. They translate programmes written in one high-level language, such as Java, into another high-level language, such as C++, that has a comparable level of abstraction. This output requires a compiler to be converted into assembly code in order for the machine to run because it is still abstract to the hardware.

Difference between compiler and Transpiler :

Compiler :

  1. It converts a high-level language source code into a low-level language output code.
  2. The abstraction level of the source code is higher than that of the output code.
  3. After linking and decoding into machine language, the assembly language output code is easily executable.
  4. In a compiler, the source code is read, parsed, transformed into an abstract syntax tree, and eventually translated into assembly language after being semantically analysed.
  5. An illustration of compilation is the translation of Java code into instructions in assembly language.

 

Transpiler :

  1. It transforms high-level source code into high-level output code in several high-level languages.
  2. The level of abstraction in both the source code and the output code is the same.
  3. A compiler is needed to translate the output code from high-level programming language into low-abstraction assembly language.
  4. The source code is parsed and translated into an abstract syntax tree in a transpiler, which is subsequently transformed into an intermediate model. The target language’s abstract syntax tree is created as a result, and code is produced.
  5. Transpilation is the process of converting Java code into C++ code, for instance.

For any Help or Queries Contact us on info@crmonce.com or +918096556344