Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2725
| From | Roger L Costello <costello@mitre.org> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Are transpiling techniques different than compiling techniques? |
| Date | 2021-10-11 13:26 +0000 |
| Organization | Compilers Central |
| Message-ID | <21-10-017@comp.compilers> (permalink) |
Hi Folks, Today I learned a new word: transpiling I looked it up and learned that it is converting one source code to another. See below. "Neat!" I thought. "I am converting a military air navigation data format to a civilian air navigation data format, which is a kind of transpiling, I think. I wonder if there are techniques specific to transpiling? Is there a book or tutorial on how to build a transpiler? Are there techniques unique to transpilers? /Roger ----------------------------------------------- Compiler: is an umbrella term to describe a program that takes source code written in one language and produce a (or many) output file in some other language. In practice we mostly use this term to describe a compiler such as gcc which takes in C code as input and produces a binary executable (machine code) as output. Transpilers are also known as source-to-source compilers. So in essence they are a subset of compilers which take in a source code file and convert it to another source code file in some other language or a different version of the same language. The ouput is generally understandable by a human. This output still has to go through a compiler or interpreter to be able to run on the machine. Some examples of transpilers: 1. Emscripten<https://kripken.github.io/emscripten-site/>: Transpiles C/C++ to JavaScript 2. Babel<https://babeljs.io/>: Transpiles ES6+ code to ES5 (ES6 and ES5 are different versions or generations of the JavaScript language) https://stackoverflow.com/questions/44931479/compiling-vs-transpiling [Back in the day, the term was "sift", from a translator from Fortran II to Fortran IV written in 1962. In the late 1960s IBM had a Fortran to PL/I translator which worked (I used it) but generated ugly code due to all the places where the semantics of PL/I were almost but not quite the same as similar looking Fortran constructs: http://bitsavers.org/pdf/ibm/360/fortran/GC33-2002-2_FORTRAN_To_PL1_Translator_Jan73.pdf I think you will find two approaches. There's the half-hearted one in which it translates contstructs into corresponding ones and hopes the differences don't matter, and the full one that is a real compiler with all of the usual analyses and a code generator that happens to generate another high level language. The f2c Fortran to C translator is an example https://www.netlib.org/f2c/f2c.pdf -John]
Back to comp.compilers | Previous | Next — Next in thread | Find similar
Are transpiling techniques different than compiling techniques? Roger L Costello <costello@mitre.org> - 2021-10-11 13:26 +0000
Re: Are transpiling techniques different than compiling techniques? Kartik Agaram <ak@akkartik.com> - 2021-10-11 11:23 -0700
Re: Are transpiling techniques different than compiling techniques? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2021-10-12 20:05 +0200
Re: Are transpiling techniques different than compiling techniques? Kaz Kylheku <480-992-1380@kylheku.com> - 2021-10-16 17:16 +0000
Re: Are transpiling techniques different than compiling techniques? Thomas Koenig <tkoenig@netcologne.de> - 2021-10-16 20:22 +0000
Re: Are transpiling techniques different than compiling techniques? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2021-10-16 23:55 +0200
Re: Are transpiling techniques different than compiling techniques? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2021-10-17 07:02 +0200
Re: Are transpiling techniques different than compiling techniques? gah4 <gah4@u.washington.edu> - 2021-10-17 15:01 -0700
Re: Are transpiling techniques different than compiling techniques? "Detlef Meyer-Eltz" <Meyer-Eltz@t-online.de> - 2021-10-12 11:34 +0200
Re: Are transpiling techniques different than compiling techniques? jan van katwijk <j.vankatwijk@gmail.com> - 2021-10-12 17:59 +0200
Re: Are transpiling techniques different than compiling techniques? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2021-10-12 20:19 +0200
Re: Are transpiling techniques different than compiling techniques? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2021-10-14 00:33 +0300
Re: Are transpiling techniques different than compiling techniques? Kaz Kylheku <480-992-1380@kylheku.com> - 2021-10-16 17:26 +0000
Re: Are transpiling techniques different than compiling techniques? gah4 <gah4@u.washington.edu> - 2021-10-17 08:37 -0700
csiph-web