5 ms·
So why is it a transpiler and not only a compiler?
by the-alt-one 5y ago
So why is it a transpiler and not only a compiler?
- detaro 5y agoBecause it compiles to a programming language of same or higher level of abstraction.
- the-alt-one 5y agoAre the techniques used different in such a case? Shouldn't it just be the same? Basically F(C) = R such that eval_C(C) = eval_R(R) where = means something like "discernible effects". Wouldn't an optimization pass be a transpiler then?
- detaro 5y agoA bunch of things a compiler "going downwards" needs to do don't apply, e.g. you don't need to worry about registers and things like that. And there's potentially more complex concepts to map to instead of just breaking source-language concepts down. Haven't seen that terminology applied to individual passes.
- the-alt-one 5y agoMost compilers don't have to worry about registers nowadays, since they compile to LLVM or C.
- detaro 5y agoIt was just an example of a task. Also, "compile to LLVM" is very much "LLVM is part of the compiler, and thus worries about registers". Compile to C is (depending on source language and exactly which definitions you use) potentially also a transpiler.
- the-alt-one 5y agoEh, I don't really see what this term gives us... So C2Rust is a compiler too, since Rust is compiled to LLVM?
- chrisseaton 5y ago> So C2Rust is a compiler too All transpilers are compilers. C2Rust is a transpiler and a compiler. Not all compilers are transpilers. Graal for example is a compiler but not a transpiler. Just like all cheese burgers are burgers but not all burgers are cheese burgers. Nobody questions the term ‘cheese burger’ because we already have the word ‘burger’.
- the-alt-one 5y agoYeah, because a cheese burger has cheese. What does a transpiler have? What is the common factor between all transpilers? Who decides on this layering of which languages are higher level or lower level? C2Rust doesn't call itself a transpiler, it calls itself a translator. This term seems completely useless to me.
- chrisseaton 5y ago> What does a transpiler have? What is the common factor between all transpilers? High to high translation. Limited lowering. > Who decides on this layering of which languages are higher level or lower level? You know it when you see it. Who decides what makes a book a 'horror book'? There's no authority on that either. You know it when you see it. > C2Rust doesn't call itself a transpiler, it calls itself a translator. Yes a translator - a translating compiler - a transpiler. > This term seems completely useless to me. Not sure why the term seems to wind people up so much - it just add a little extra info.
- chrisseaton 5y agoIt’s just a slightly more descriptive term that gives you the information that it’s high-to-high. It’s like saying cheese burger instead of burger - it’s a little more info. It’s not saying that it’s not a burger as well, or that the techniques involved aren’t broadly the same.
- psychoslave 5y agoThere are all transglosser anyway. :P