6 ms·
It doesn't matter but I fully disagree with this. A transpiler emits code the user is supposed to understand, a compiler does not. At least that's the general w
by markusde 2y ago
It doesn't matter but I fully disagree with this. A transpiler emits code the user is supposed to understand, a compiler does not. At least that's the general way I've seen the term used, and it seems quite consistent.
- eklavya 2y agoI see what you mean but how is it academically useful to identify transpilers something of their own? It's still compiling (lowering) from one notation to another.
- randomdata 2y agoAll compiler outputs are understandable. I suppose you mean with the intent of it being a one-time translation? As in, like when the Go project converted the original C codebase into Go source with the intent of having developers work in the Go output afterwards and the C code to be never touched again? What is meaningful about such a distinction?
- Jtsummers 2y ago> A transpiler emits code the user is supposed to understand, a compiler does not. No, a transpiler emits code that another system is meant to understand (often another compiler or interpreter). Whether a human can understand it or not is immaterial to the objective of transpiling.
- rowanG077 2y agoBut then compilation is the same thing as transpilation as noted.
- Jtsummers 2y agoYes.
- randomdata 2y agoDoes that imply that a compiler emits code that nothing can understand? Or are you saying that 'transpile' is just another word for 'compile'?
- Jtsummers 2y ago> Does that imply that a compiler emits code that nothing can understand? Bizarre take. No, compilers in the classical sense target byte code and machine code which is meant to be interpreted by a byte code interpreter or a hardware machine. > Or are you saying that 'transpile' is no more than another word for 'compile'? Yes. Compilers translate from one language to another. Transpilers translate from one language to another. Both have the objective of preserving the behavior of the program across translation. Neither has the objective of making something intended for humans as a general rule. That transpiled code (if we draw a distinction) targets languages meant for humans to read/write means that many transpiled programs can be read by people, but it's not the objective.
- randomdata 2y ago> Bizarre take. Bizarre in what way? If compilers are somehow different, then they mustn't target systems, as that's what your previous comment says transpilers do. Which leaves even your own classical definition to be contradictory, if they are somehow different. What does that leave? > Yes. But it seems you do not consider them different, which was the divergent path in the previous comment. But evaluating both the "if" and the "else" statement is rather illogical. The evaluation of both branches is what is truly bizarre here.
- jerf 2y agoThere is a phenomenon I have observed many times where you can get a bunch of people in a room and make some statement, in this case, "Compilers are different than transpilers", and everyone around the table will nod sagely. Yup. We all agree with this statement. But if you dig in, it will turn out that every single one of them has a different interpretation, quite often fatally so to whatever the task at hand is. I mention this because my impression has been that the distinction between "transpiler" and "compiler" is that the latter is into some machine code and the former is not. I think if we could get people to sit down and very clearly define the difference we'd discover it is not as universal a definition as we think. My personal favorite is when I say a particular term is not well defined on the internet, and I get multiple commenters to jump up and tell me off about how wrong I am and how well-defined the term is and how universal the understanding is, while each of them gives a completely different definition. As I write this it hasn't happened in this thread yet, but stay tuned. Anyhow, the simple solution is, there isn't a useful distinction between them. There's no sharp line anyhow. Plenty of "transpilers" produce things like Python that looks like def f000000001_bch(a0023, a0024, bf___102893): __a1 = f000000248_BCh1(a0024, const_00012) if __c_112__0: f0000000923(__a1) else: f0000000082(__a1) and it's really quite silly to look at what can be a very large process and make a distinction only in how the very last phase is run, and on a relatively superficial bit of that last phase too.
- floydnoel 2y agoI've observed this sort of behavior frequently, is there a name for this phenomenon yet? Something like "Assuming all concepts are universal to one's own peculiar definition" Maybe "semantic egocentrism" could fit the bill?
- zer00eyz 2y agoAnd in the other corner you have Chomsky with universal grammar... and in another you have Platonic Forms... I love the "draw me a tree" idea of a Platonic form, we all have an idealized model of what that is, that is uniquely our own. With that in mind isnt everything subject to some sort of semantics?
- 2y ago
- itishappy 2y agoIs Babel a transpiler?
- unshavedyak 2y agoYea, not sure i disagree with anything being said here. Though to me, transpiler just typically means it goes from one language i could write, to another i could write. I don't necessarily expect to enjoy reading or perhaps even understanding the JavaScript output from any lang that builds to JS, for example.
- randomdata 2y ago> transpiler just typically means it goes from one language i could write, to another i could write. What possible compiler target couldn't you write? Compilers are not exactly magic.
- unshavedyak 2y agoFair, by "could write" i meant one intended for humans to write. Ie i would not say LLVM bytecode is intended for humans to write by hand. Can they? Sure. The difference (to the parent comment) in my eyes is that the target language is the thing intended for humans, not the target output itself. As another commenter points out, transpiled code is often not intended for humans, even if the language is.
- randomdata 2y agoMachine code is intended to be written by humans. That was the only way to program computers at one point in time. Given a machine code target, would you say it is product of transpilation or compilation?
- unshavedyak 2y agoI would stand by my original statement, as i don't consider that "intended" or common by modern day standards. Humans hand wrote binary for a while too hah. If it's not clear, these are just my opinions. Not an attempt at an objective fact or anything.
- 2y ago
- philwelch 2y agoActually, I can understand assembly.
- keybored 2y ago> A transpiler emits code the user is supposed to understand, a compiler does not. How come Godbolt is so popular? Inspecting compiler output? Is GCC now officially a transpiler?