Compiler & Transpiler

Compiler & Transpiler

Transpiler the saviour!

The compiler takes in some code as input and produces a binary executable code aka machine code as output. For example - we use GCC compiler to compile the C/C++ code and it produces the machine code.

Transpilers aka source-to-source compilers read the code in one language and produce the code in another language.

In layman language, get a good driving sense and you'll reach the destination safely! The convenience of a driver is what matters the most. When you learn to drive, you get a driving sense. The focus here is to have a driving sense (driving sense === transpiler). Driving a car has different actions (actions = gears, clutch, steering) and driving a scooter has different actions (actions = just accelerator and break) and you still get a driving sense. So, to conclude this - "put in actions and a driving sense and get a safe ride". A safe ride is the desired output!

CraftyTemptingAfricanwildcat-max-1mb.gif

In technical terms, someone writes the same thing in TypeScript, JavaScript, CoffeeScript, etc but the Js environment understands Js only. Here comes Transpilers as a saviour. Just like template literals work fine with the latest version of our modern browsers but it won't work properly with browsers with an older version. So, we write our code in ES6+ and let the transpiler converts it to some different version (ES5/ES3, that works in every browser).

In layman language again, no matter how bad or good is the road, driving sense + actions comes in and you'll ride safely to your destination. And by the type of road, I mean the different languages (Ts, Js, Cs, etc).

im-home-going.gif

Thanks for reading :)