transpile vs. compile

2020-03-03

 | 

~1 min read

 | 

167 words

What does it mean when we say that babel is a transpiler?

According to Shawn Wang (known on the internet as swxy), when babel transpiles, it “compile[s] from Javascript to Javascript”.1

So, if we’re comparing transpiling to compiling - the former is from it’s language to itself (at a target specified by the developer to be compatible with the consuming application — in this case the various browsers) while the latter is taking a language and transforming it into a different language - whether it’s a lower level language (C or C++) or machine code.

Update According to this article on ReScript, the above definition is not quite right. Instead a transpiler is a compiler which targets another language (any language) while a compiler targets bytecode. Considering the Elm compiler (which is the project’s name, not transpiler) targets Javascript, I’m still inclined believe Shawn.

Footnotes


Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!