Re: Cross compiler questions

"Quinn Tyler Jackson" <qjackson@home.com>
9 Sep 2000 13:16:24 -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: "Quinn Tyler Jackson" <qjackson@home.com>
Newsgroups: comp.compilers
Date: 9 Sep 2000 13:16:24 -0400
Organization: Compilers Central
References: 00-09-044
Keywords: design

VBDis said:


> 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.


[...]


> 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.


At the specific level of language A to F, where A and F are Basic and
Delphi in this case, you can map cliches. (q.v. some of the Balmas
papers reviewed on my site in the literature review section).
Depending on the granularity you decide upon, the cliches will
represent lower and lower level constructs. At the structural level,
at least, the three cliches of structured programs, for instance, are
simply mapped back and forth, where A and F both comprise constructs
that allow this simple mapping. But as you've noticed, such high
level abstractions do not sufficiently account for the semantic
differences of A and F, and so, your granularity must be increased.


If some construct at granularity N does not map sufficiently well to
some other construct also at granularity N, you have to decompose the
semantic construct into something smaller and more abstract, and then
that group of abstractions have to be mapped to language F, thus:


        A -> bcde -> F


The atoms "bcde" of course, being sufficiently expressive semantically
to map to all semantic constructs of both A and F, where A and F are
theoretically infinite sets. To be sufficiently expressive, the
intermediate language has to be sufficiently abstract that F comes out
looking like chicken scratch. Since A maps to bcde maps to F, then
does F always map back to A?


This is a damsel in a tower that all (for any value of "all") language
enthusiasts would like to call up to, saying, "UNCOL, o UNCOL, please
let down your hair!" That way be dragons.


If you would like a taste of some of the issues that this Holy Grail
leads to, checked out the comp.compiler archives by going to:


        http://compilers.iecc.com/comparch/compsearch


And with the search term UNCOL (full text and subject, if you have
some large amount of free time).
--
Quinn Tyler Jackson


http://qtj.n3.net/~quinn/


Post a followup to this message

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