Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: "Detlef Meyer-Eltz" Newsgroups: comp.compilers Subject: Re: Are transpiling techniques different than compiling techniques? Date: 12 Oct 2021 11:34:04 +0200 Organization: Compilers Central Lines: 43 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <21-10-019@comp.compilers> References: <21-10-017@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="40197"; mail-complaints-to="abuse@iecc.com" Keywords: translator Posted-Date: 12 Oct 2021 11:18:15 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <21-10-017@comp.compilers> Xref: csiph.com comp.compilers:2727 I'm working for years on the Delphi to C++ translater "Delphi2Cpp", without beeing aware, that this kind of software is called a "transpiler". https://www.texttransformer.com/Delphi2Cpp_en.html What might come close to a special transpiler technique are "rewrite rules" of syntax trees. But I use a naive approach with no mysterious transpiler theory in the background. I shortly describe the steps that are done during conversion: 1. the Delphi source code is pre-processed according to the set conditions 2. the resulting reduced code is parsed to build a syntax tree 3. the syntax tree is pre-processed to calculate some information needed for the output. 4. the syntax tree is output as C++ code For the first two steps an own parser generator called "TextTransformer" is used. The first step can be regarded as a kind of compilation/"transpilation" of its own. An example for the third step is the calculation of the variables that have to be passed to sub-functions, when nested functions are unbundled. A lot of manual work has to be done for the fourth step. Numerous special cases have to be hard-coded there, as there is no simple deduction relationship between the source language and the target language. Some Delphi constructs cannot be converted at all. But C++ is more powerful than Delphi, so that many Delphi constructs can be reconstructed or simulated in C++. A converter the other way round would be quite poor. The power of a language could be part of a transpiler theory. In contrast to a compiler, which has to be fast because it is used over and over again in the development of software, the speed of the tranpiler does not matter: ideally, it only has to be used once to do its job. Detlef Am 11.10.2021 um 15:26 schrieb Roger L Costello: > Hi Folks, > > Today I learned a new word: transpiling