0

I'm curious about the terminology for compilers with JavaScript.

When you're writing about or describing technologies like Webpack (bundles multiple files into one, and performs optimization) and Babel (converts ES6 to an older version of JavaScript), would compiler be the best word to describe these?

  • 1
    Babel is a transpiler, which is just a compiler where the source and target languages are both high-level languages. Webpack is just... Webpack. Portions of Webpack might be considered to perform the function of a compiler, which is to translate one programming language into another. – Robert Harvey Jul 16 at 0:45
3

Yes, I think so.

A compiler parses input (text) in one language and outputs code in another language.  It generally requires a parser, some intermediate representation, and a (code) generator.  There may be optimization phases that analyze the intermediate representation for possible efficiency improvements.  In some sense a compiler is a big de-serializer and serializer coupled together by an intermediate data structure.

A transpiler aka source-to-source compiler is a compiler.


(Please note that source-to-source is a 100% misnomer, it really should be text-to-text, as not all text is source — especially compiler output that is text!  Source is only that which must be protected because it cannot be regenerated.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.