What is the main difference between a Compiler and a Transpiler?

They’re essentially the same: take source code and transform it to something else.

The difference is that compiler usually produces a directly usable artifact (executable binary of some sort). Example: C (produces binary), C# (produces bytecode).

Whereas transpiler produces another form of source code (in another language, for example), which is not directly runnable and needs to be compiled/interpreted. Example: CoffeeScript transpiler, which produces javascript. Opal (converts ruby to javascript)

Leave a Comment