5 ms·
I thought that the technical term for parsing a high-level programming language to output another high-level programming language was transcompiling. https://e
by rualca 5y ago
I thought that the technical term for parsing a high-level programming language to output another high-level programming language was transcompiling.
https://en.wikipedia.org/wiki/Source-to-source_compiler https://en.wikipedia.org/wiki/Source-to-source_compiler
- dom96 5y agoYes, but most of the time C is considered to be low-level (and usually is lower level than the language that compiles to it). So “transpiling” is not correct.
- IncRnd 5y agoTranspiling is source language to source language, regardless of whether either of those languages is considered high livel. In this case, transpiler is the correct term.
- kryptiskt 5y agoIt's not the correct choice. For one, transpiling is an unnecessary word, there is no information value in it and the domain experts don't use it and never have. For another, C isn't the target, C is an intermediary language used to produce the binaries. The C produced by these compilers is highly unidiomatic and not meant for human consumption.
- rualca 5y ago> For one, transpiling is an unnecessary word, No, not really. Transpiring is an entirely different problem, and one which is not limited to programming languages. Transpiring involves parsing a high-level language down to an intermediate language, and afterwards encode it back to a high-level language. Therefore problems involving semantics enter into play, instead of just transforming high-level constructs down to primitives.
- chrisseaton 5y ago> the domain experts don't use it and never have Not true! You see it used in the academic literature I think as far back as the 1960s. I also use it myself (PhD in languages and practising professionally ever since - take that as being an expert or not up to you) and I think most of my peers would use it and understand it as well. To me transpiling implies translation from one source language that a human would normally expect to use directly to another. That's extra information over 'compiler'.
- IncRnd 5y agoA source language does not mean a representation meant for human consumption but a language that is intended to be translated. You say that transpiling does not carry any additional information, but that is only supported by your implicit assumption that transpiling only produces idiomatic code that humans will edit. You say that domain experts do not use the word transpiling. From this one infers that you believe you are a domain expert and others are not. In the best light, you are taking your personal experience and applying it globally. You present that as an argumentum ad baculum, which is a fallacy in its own right, but it is really the conjunction of an availability bias couched in a hasty generalization. Plus, your statement is false - domain experts do use the word transpiling, just maybe not people in your circle.
- Someone 5y agoThen gcc is a transpiler, too. It translates C/C++ to assembly language.
- IncRnd 5y agoThe part of gcc that translates one source representation to another transpiles, yes. That is not mean that the word compilation shouldn't be used. It's similar to saying that all children are people, but not all people are children.
- dom96 5y agoThat's not how Wikipedia defines it. From https://en.wikipedia.org/wiki/Source-to-source_compiler https://en.wikipedia.org/wiki/Source-to-source_compiler > A source-to-source translator converts between programming languages that operate at approximately the same level of abstraction, while a traditional compiler translates from a higher level programming language to a lower level programming language. Like I said, translating a high-level language like Python to a low-level one like C wouldn't be considered transpilation. It would be compilation. Just as translating C code to Asm is considered compilation.
- Someone 5y agoWikipedia disagrees, but for me, the defining feature of a transpiler is that its goal isn’t running the program but getting human-readable source code that can be maintained. So you get your COBOL source code, transpile to Java, throw away the COBOL code (1), and let humans do maintenance on the Java code from there on. Converting to (often) messy C with the sole goal of reusing its compiler for me it’s t transpiling. (1) of course, caution dictates that keeping that code around is a good idea.
- rualca 5y ago> 5Wikipedia disagrees, but for me, the defining feature of a transpiler is that its goal isn’t running the program but getting human-readable source code that can be maintained. No, not really. Perhaps the typescript transpiler is the most widely used transpiler in history, and anyone with a cursory experience in typescript can tell you that the transpiler's role is to just generate the code intended to be packaged or fed to a barreler without any human ever looking into what code is generated. Another famous example was the initial "c with classes" transpiler which was the precursor of C++.
- jhgb 5y agoThose are compilers, then. Just like traditional C compilers emit intermediate files in assembly.