|Cross compiler questions email@example.com (2000-09-08)|
|Re: Cross compiler questions firstname.lastname@example.org (Quinn Tyler Jackson) (2000-09-09)|
|From:||"Quinn Tyler Jackson" <email@example.com>|
|Date:||9 Sep 2000 13:16:24 -0400|
> 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:
And with the search term UNCOL (full text and subject, if you have
some large amount of free time).
Quinn Tyler Jackson
Return to the
Search the comp.compilers archives again.