Cross compiler questions

vbdis@aol.com (VBDis)
8 Sep 2000 02:11:53 -0400

          From comp.compilers

Related articles
Cross compiler questions vbdis@aol.com (2000-09-08)
Re: Cross compiler questions qjackson@home.com (Quinn Tyler Jackson) (2000-09-09)
| List of all articles for this month |

From: vbdis@aol.com (VBDis)
Newsgroups: comp.compilers
Date: 8 Sep 2000 02:11:53 -0400
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
Keywords: translator, question

I have just implemented a Basic to Delphi converter, and want to make
it more flexible, with more input and output languages.


In my program I'm constructing a tree to represent all procedures,
statements and expressions, which afterwards can be converted into
source code of sufficiently "compatible" languages. This approach was
borrowed from my old C decompiler, and therefore should work for C
output, too.


Now I found some general problems, related to different approaches in
different programming languages. One problem arises from the handling
of conditions, where Pascal requires true boolean expressions, whereas
Basic only looks for zero/nonzero results, and C has separate logic
and bitwise operators. In addition the definition of True differs,
being -1 in Basic, less/eqal/greater in Fortran threeway branches, 1
or True in other languages). This makes it difficult to determine,
what final logic result is determined in a given expression.


Another problem is the translation of data types and operators. No big
deal with Basic, since there usually only a few predefined data types
exists, but a mess with strings, bitfields, classes, properties and
other language specific constructs.


Now I want to discuss some of these topics, and I'm also looking for
material on this subject (literature, URLs, code...).


The whole project is written in Delphi, and will be published in my
homepage, as soon as the source code reaches a more stable state.


Thanks for any contributions
    DoDi


Post a followup to this message

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