Live data from Hacker News

Transpiler, a Meaningless Word (2023)

people.csail.mit.edu

1–10 of 117 posts

Re: Transpiler, a Meaningless Word (2023)

#3
post #2

"Transpiler" is no less well-defined a term than "compiler".

The definition of compiler i learned was “takes some code, translate it to semantically equivalent code in a different language (which might be machine language, bytecode…)”. This is also used in PLaI, a respected learning resource: https://www.plai.org/

I think this is a pretty acceptable definition, and yes, it does make the term transpiler a little useless.

Re: Transpiler, a Meaningless Word (2023)

#4
post #3
post #2

"Transpiler" is no less well-defined a term than "compiler".

The definition of compiler i learned was “takes some code, translate it to semantically equivalent code in a different language (which might be machine language, bytecode…)”. This is also used in PLaI, a respected learning resource: https://www.plai.org/ I think this is a pretty acceptable definition, and yes, it does make the term transpiler a little useless.

[deleted]

Re: Transpiler, a Meaningless Word (2023)

#5
> Compilers already do things that “transpilers” are supposed to do. And they do it better because they are built on the foundation of language semantics instead of syntactic manipulation.

So you do know the difference.

Re: Transpiler, a Meaningless Word (2023)

#6
IMO: Transpilers are compilers, but not all compilers are transpilers.

In my book, transpilers are compilers that consume a programming language and target human-readable code, to be consumed by another compiler or interpreter (either by itself, or to be integrated in other projects).

i.e. the TypeScript compiler is a transpiler from TS to JS, the Nim compiler is a transpiler from Nim to C, and so on.

I guess if you really want to be pedantic, one can argue (with the above definition) that `clang -S` might be seen as a transpiler from C to ASM, but at that point, do words mean anything to you?

Re: Transpiler, a Meaningless Word (2023)

#8
post #3
post #2

"Transpiler" is no less well-defined a term than "compiler".

The definition of compiler i learned was “takes some code, translate it to semantically equivalent code in a different language (which might be machine language, bytecode…)”. This is also used in PLaI, a respected learning resource: https://www.plai.org/ I think this is a pretty acceptable definition, and yes, it does make the term transpiler a little useless.

What I would add to your definition, to make a distinction from the common usage of compilation, is that the target language is on an approximately equivalent level of abstraction to the source. So, for example, Rust -> machine code is not transpilation, but Rust -> C++ is.

I think this is how the word is commonly understood, and it’s not useless (even if there’s no absolute standard of when it does or does not apply).

Edit: sorry, realise I should have read the article before commenting. The article calls out my definition as one of their ‘lies’. I guess I just disagree with the article. Words can be useful even without a 100% watertight definition. They’re for communication as well as classification.

Re: Transpiler, a Meaningless Word (2023)

#9

IMO: Transpilers are compilers, but not all compilers are transpilers. In my book, transpilers are compilers that consume a programming language and target human-readable code, to be consumed by another compiler or interpreter (either by itself, or to be integrated in other projects). i.e. the TypeScript compiler is a transpiler from TS to JS, the Nim compiler is a transpiler from Nim to C, and so on. I guess if you…

I'd probably say that "transpiler" is not a very useful word with that definition.

Re: Transpiler, a Meaningless Word (2023)

#10
post #8
post #3

Earlier quoted context omitted.

The definition of compiler i learned was “takes some code, translate it to semantically equivalent code in a different language (which might be machine language, bytecode…)”. This is also used in PLaI, a respected learning resource: https://www.plai.org/ I think this is a pretty acceptable definition, and yes, it does make the term transpiler a little useless.

What I would add to your definition, to make a distinction from the common usage of compilation, is that the target language is on an approximately equivalent level of abstraction to the source. So, for example, Rust -> machine code is not transpilation, but Rust -> C++ is. I think this is how the word is commonly understood, and it’s not useless (even if there’s no absolute standard of when it does or does not apply…

What value does the word have? When I'm writing a compiler, it doesn't matter whether I target C or asm, or Javascript, as my output language. I'll still write it the same way.
Post reply on HN