Re:V8 Sparkplug – A non-optimizing JavaScript compiler
by rkagerer on Thursday May 27, 2021 @03:48PM
(#27307362)
A CPU is effectively an interpreter itself, albeit one for machine code; seen this way, Sparkplug is a "transpiler" from Ignition bytecode to CPU bytecode, moving your functions from running in an "emulator" to running "native".
[ Parent
| on HN ]
Re:V8 Sparkplug – A non-optimizing JavaScript compiler
by quotemstr on Thursday May 27, 2021 @04:33PM
(#27308068)
Yep. Formally in CS, there's no difference between a "compiler" and a "transpiler". They're both names for the process of program translation. All compilation is "transpilation", even when you're compiling things like C++.
Re:V8 Sparkplug – A non-optimizing JavaScript compiler
by hajile on Thursday May 27, 2021 @05:22PM
(#27308714)
To me, in general, compiling seems to imply native output where optimizations are done while transpiling seems to target another high-level language where semantics are kept as close to the original as possible.
Re:V8 Sparkplug – A non-optimizing JavaScript compiler
by kragen on Thursday May 27, 2021 @08:19PM
(#27310300)
You are welcome to use the word "compile" with a non-standard definition, but its standard definition does not imply either that the output is native code or that optimizations are done. There are numerous well-known compilers whose target language is not native code (the original Cfront, javac, C++ on the CIL, most Pascal compilers from the 01970s, Chicken, GHC's old C backend) and numerous well-known compilers whose output is totally unoptimized (tcc, perl -MO=C, META-II, arguably the original Turbo Pascal). So if you want to understand what other people are saying about "compilers" you should keep in mind that the standard definition includes what you are calling "transpilers".
Re:V8 Sparkplug – A non-optimizing JavaScript compiler
by kaba0 on Thursday May 27, 2021 @06:47PM
(#27309559)
There is no real distinction, it is all just bad usage of the word. There are only compilers. It may compile to a high level language, but “transpiling” adds zero information to the sentence.
Re:V8 Sparkplug – A non-optimizing JavaScript compiler
by throwawaw on Friday May 28, 2021 @01:50PM
(#27318428)
I just say "compile", too, because it's strictly correct and I like being correct. But "transpiling adds zero information" seems unfair: when you see that word, you at least know the speaker meant "compiling to something other than machine code". No one has ever called gcc a transpiler, so they definitely aren't talking about gcc.
I like the reasoning in the sibling comment:
> So if you want to understand what other people are saying about "compilers" you should keep in mind that the standard definition includes what you are calling "transpilers".
Really, the main disadvantage of saying "transpile" is that it implies you don't know what "compile" means. In a context where that wasn't an issue -- e.g., if I heard it from one of my coworkers, who certainly know what a compiler is -- I would just think they liked the neologism.
Re:V8 Sparkplug – A non-optimizing JavaScript compiler
by kaba0 on Friday May 28, 2021 @02:24PM
(#27318823)
I meant the zero information part like you have to state what is the output. So in a typical sentence containing “transpiler”, you would say something like “Nim transpiles to C” - which has the exact same information content as “Nim compiles to C”.
Re:V8 Sparkplug – A non-optimizing JavaScript compiler
by TazeTSchnitzel on Thursday May 27, 2021 @06:55PM
(#27309625)
Compiling between high-level languages is a similarly difficult endeavour to compiling to low-level ones!