Live data from Hacker News

Transpiler, a Meaningless Word (2023)

people.csail.mit.edu

71–80 of 117 posts

Re: Transpiler, a Meaningless Word (2023)

#71
post #22

Earlier quoted context omitted.

For me, the "human-readable" part is key. It's not just that the output is e.g. javascript, but that it is more or less human-readable with about the same organization as the original code. If you implement SKI combinators, or three-address instructions, as functions in javascript, and that's the output of your compiler, I would not call that a transpiler.

Would it still count as a transpiler if it minifies the code at the end? For example, most SCSS workflows I've worked with converert SCSS source code into minified CSS, which is pretty difficult for a human to read. But I think that SCSS => CSS still counts as transpiling.

> Would it still count as a transpiler if it minifies the code at the end?

I would say "yes, but the minimization is an additional step that is not actually a direct part of the transpiling process." :-)

So, a program that does this would not a transpiler by itself, but a program that

- executes a pipeline of which the transpiling is the most important step,

- can also be used as a transpiler by making transpiling the only step in the executed pipeline.

Re: Transpiler, a Meaningless Word (2023)

#72
I think it's pretty clear to anyone with experience in the field that the notion of compilers, interpreters, transpilers are porous and even more so when you had the concept of VM ("Let's interpret a compiled artefact") and JIT ("I put a compiler in your interpreter. Don't worry, it all runs on the same VM in the end.")

These things live on a continuum. Still, I think the different worlds are useful. They put forward different concepts and ideas. It helps framing things.

Re: Transpiler, a Meaningless Word (2023)

#73
post #65

Earlier quoted context omitted.

I'm not convinced your L/S dichotomy applies. The concern there is that the natural world (or some objective target domain) has natural joints, and the job of the scientist (, philosopher, et al.) is to uncover those joints. You want to keep 'hair splitting' until the finest bones of reality are clear, then grouping hairs up into lumps, so their joints and connections are clear. The debate is whether the present cate…

> i think the apparent 'lumper' is just a person ignorant of classification scheme offered, or at least, ignorant of what property it purports to capture. >In each case there is a real objective distinction No, Lumper-vs-Splitter doesn't simply boil down to plain ignorance. The L/S debate in the most sophisticated sense involves participants who actually know the proposed classifications but _chooses_ to discount the…

I agree there can be such debates; that's kinda my point.

I'm just saying, often there is no real debate it's just one side is ignorant of the distinctions being made.

Any debate in which one side makes distinctions and the other is ignorant of them will be an apparent L vs. S case -- to show "it's a real one" requires showing that answering the apparent L's question doesnt "settle the matter".

In the vast majority of such debates you can just say, eg., "transpilers are compilers that maintain the language level across input/output langs; and sometimes that useful to note -- eg., that typescript has a js target." -- if such a response answers the question, then it was a genuine question, not a debate position.

I think in the cases you list most people offering L-apparent questions are asking a sincerely learning question: why (because I don't know) are you making such a distinction? That might be delivered with some frustration at their misperception of "wasted cognitive effort" in such distinction-making -- but it isnt a technical position on the quality of one's classification scheme

Re: Transpiler, a Meaningless Word (2023)

#74
post #16

Whenever someone argues the uselessness or redundancy of a particular word, a helpful framework to understand their perspective is "Lumpers vs Splitters" : https://en.wikipedia.org/wiki/Lumpers_and_splitters An extreme caricature example of a "lumper" would just use the word "computer" to label all Turing Complete devices with logic gates. In that mindset, having a bunch of different words like "mainframe" , "pc" , "…

>An extreme caricature example of a "lumper" would just use the word "computer" to label all Turing Complete devices with logic gates.

"Computer"? You mean object, right?

Re: Transpiler, a Meaningless Word (2023)

#75
post #16

Whenever someone argues the uselessness or redundancy of a particular word, a helpful framework to understand their perspective is "Lumpers vs Splitters" : https://en.wikipedia.org/wiki/Lumpers_and_splitters An extreme caricature example of a "lumper" would just use the word "computer" to label all Turing Complete devices with logic gates. In that mindset, having a bunch of different words like "mainframe" , "pc" , "…

I think the argument here is not really where one should draw the line and whether transpiler should be a different word...

I think the argument centers on how transpilers are often justified as being something quite different in difficulty than writing a whole compiler -- and in practice, nearly the whole set of problems of writing a compiler show up.

So, it's more like, don't use the distinction to lie to yourself.

Re: Transpiler, a Meaningless Word (2023)

#76

Earlier quoted context omitted.

Would it still count as a transpiler if it minifies the code at the end? For example, most SCSS workflows I've worked with converert SCSS source code into minified CSS, which is pretty difficult for a human to read. But I think that SCSS => CSS still counts as transpiling.

> Would it still count as a transpiler if it minifies the code at the end? I would say "yes, but the minimization is an additional step that is not actually a direct part of the transpiling process." :-) So, a program that does this would not a transpiler by itself, but a program that - executes a pipeline of which the transpiling is the most important step, - can also be used as a transpiler by making transpiling th…

What if the minification is inseparable from the transpiler? Like what if it converts the SCSS into some weird graph representation, applies the transpilation features (variables, mixins, etc) on that graph representation, then converts the graph representation into minified CSS? At no point in the process was it ever human-readable CSS. I don't know enough about the internals of transpilers to know if they actually do anything like this, but one could imagine a hypothetical program that does.

And furthermore, what if you run Prettier on the minified output, turning it into readable CSS? The pipeline as a whole would input SCSS and output formatted CSS and therefore would be considered a transpiler, but the subprogram that does all of the SCSS heavy lifting would input SCSS and output minified SCSS, making it not a transpiler.

P.S. I love your username

Re: Transpiler, a Meaningless Word (2023)

#77
post #16

Whenever someone argues the uselessness or redundancy of a particular word, a helpful framework to understand their perspective is "Lumpers vs Splitters" : https://en.wikipedia.org/wiki/Lumpers_and_splitters An extreme caricature example of a "lumper" would just use the word "computer" to label all Turing Complete devices with logic gates. In that mindset, having a bunch of different words like "mainframe" , "pc" , "…

> But an enthusiast would get irritated and argue "Bach is not classical music, it's Baroque music. Mozart is classical music."

Baroque music is a kind of classical music, though.

Re: Transpiler, a Meaningless Word (2023)

#78
A compiler takes in one language and outputs some other language. E.g. C to LLVM IR or LLVM IR to x86_64 assembly.

An assembler is a type of compiler that takes in an assembly language and outputs machine code.

A transpiler is a type of compiler that takes in a language commonly used by humans to directly write programs and outputs another language commonly used by humans to directly write programs. E.g. c2rust is a C to unsafe Rust compiler, and since both are human-used languages it's a transpiler. Assembly language isn't commonly written by humans though it used to be, so arguably compilers to assembly language are no longer transpilers even though they used to be.

The existence of a transpiler implies a cispiler, a compiler that takes in code in one language and outputs code in that same language. Autoformatters are cispilers.

Re: Transpiler, a Meaningless Word (2023)

#79
post #16

Whenever someone argues the uselessness or redundancy of a particular word, a helpful framework to understand their perspective is "Lumpers vs Splitters" : https://en.wikipedia.org/wiki/Lumpers_and_splitters An extreme caricature example of a "lumper" would just use the word "computer" to label all Turing Complete devices with logic gates. In that mindset, having a bunch of different words like "mainframe" , "pc" , "…

"Compiler" encompassing "transpiler" I think is wrong anyway. There's a third term that doesn't seem to get nearly as much pushback, that didn't come up in your link, has yet to be mentioned here, and isn't in the article, but adds context for these two: decompiler.

Compiling is high-level to low-level (source code to runnable, you rarely look at the output).

Decompiling is low-level to high-level (runnable to source code, you do it to get and use the output).

Transpiling is between two languages of roughly the same level (source code to source code, you do it to get and use the output).

Certainly there's some wishy-washy-ness due to how languages relate to each other, but none of these terms really acts like a superset of the others.

Re: Transpiler, a Meaningless Word (2023)

#80
I like the cover of the book Crafting Interpreters: https://craftinginterpreters.com/image/header.png

It's basically a flowchart showing all of the different things that we mean when we say compiler/interpreter/transpiler, and which bits they have in common.

Funny, but it has two paths for transpiler - the kind that parses and outputs source from an AST, and the asm.js kind, that actually just uses a high-level language as an assembly-ish target.

Post reply on HN