transpiler

A compiler is a program that converts code from high-level programming language (e.g. C, C++, Java) to a low-level language (e.g. assembly language, byte-code, machine language). We have been using compilers for decades now. Transpiler, also known as a source-to-source compiler or a transcompiler is a specific type of compiler where input and output languages are at a similar level of abstraction.

What is a transpiler exactly?

Transpiler takes source code from one language as input and produces source code in another language as output. Both languages happen to be at the same level of abstraction. e.g. A transpiler may translate a code from Pascal to C or C++ to C.

Transpiler
Use power tools to improve your productivity

There are quite a few languages which use transcompilers. TypeScript and CoffeScript get compiled into JavaScript using a transcompiler. TypeScript and CoffeeScript provide a certain level of additional features such as OOP which are not present in base JavaScript. Thus by using TypeScript or CoffeeScript, developers can write the code using their OOP expertise and still get it converted JavaScript which is so much popular these days.

What are the advantages of using transpiler?

Transpilers enable developers to use their favorite language and then convert it to the target language which is used in the application. At times the language of choice may provide additional features which are not available in the base language. However, transpiler can convert the additional features into code that is compatible with base language.

Another purpose of the transpiler is to convert legacy code into a newer version of the code.

In a specific example of JavaScript, there’s a huge variation in the support for features across the browsers. Transpiler that converts your code to base ES2015 (EcmaScript) could be a huge benefit as it will increase the compatibility across the browsers.

Related Links

Related Keywords

TypeScript, CoffeeScript, EcmaScript, Trasncompiler, Source-to-source compiler.

One Reply to “transpiler”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.