Re: Source-to-source transformation: best approach?

Detlef Meyer-Eltz <Meyer-Eltz@t-online.de>
Sat, 11 Aug 2007 01:04:32 +0200

          From comp.compilers

Related articles
Source-to-source transformation: best approach? somedeveloper@gmail.com (SomeDeveloper) (2007-08-04)
Re: Source-to-source transformation: best approach? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-08-07)
Re: Source-to-source transformation: best approach? Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2007-08-11)
Re: Source-to-source transformation: best approach? idbaxter@semdesigns.com (2007-08-11)
Re: Source-to-source transformation: best approach? cfc@shell01.TheWorld.com (Chris F Clark) (2007-08-12)
Re: Source-to-source transformation: best approach? cordy@cs.queensu.ca (Jim Cordy) (2007-08-14)
| List of all articles for this month |

From: Detlef Meyer-Eltz <Meyer-Eltz@t-online.de>
Newsgroups: comp.compilers
Date: Sat, 11 Aug 2007 01:04:32 +0200
Organization: Compilers Central
References: 07-08-013
Keywords: translator
Posted-Date: 10 Aug 2007 20:11:30 EDT

>Basically, I do not know what conceptual 'dead-end' I'd run into in
>future if today I were to choose a recursive descent parser such as


TXL is an interesting quite new approach for source to source
translations. I never used it and can't estimate the difficulties in
which you can run with it.


My opinion: if you want to be sure that you don't get into a dead end,
then choose a parser generator which supports a language which you
master well and which is able to parse your source language. If you
can parse your source language with a recursive descent parser, this
is certainly a good choice. If you can parse the sources with it, you
also will find a way to translate them.


Except from TXL I don't recommend automatically generated AST's. They
might be useful, if the same grammar shall be used for different
purposes. But to evaluate them, you have to do a kind of secondary
parsing to look up the information you need. In recursive descent
parsers you can already do some new arrangements of the parsed input
during the parsing process. You can arrange it in a special tree
designed by you, which is appropriate for your translation. You also
can build a table of the just recognized types.


If you would have told, with which pair of languages you are dealing,
I could have made perhaps more concrete suggestions. Personally, I'm
just developing a translator from c++ to java. I'm using
TextTransformer (http://www.texttransformer.com) for this job.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.