From: | Darius Blasband <darius@phidani.be> |
Newsgroups: | comp.compilers |
Date: | 16 May 1997 23:38:45 -0400 |
Organization: | Phidani Software, Brussels |
References: | 97-05-183 |
Keywords: | C, assembler |
Ray Dillinger wrote:
> I've been looking for a good target language for compilation;
> ...
> However, this will violate every "reasonable" assumption a maker of C
> compiers will have about programming style. It will mean a program is
> compiled into a *single routine* of C code, with Goto destinations
> that might be more than 64K bytes away -- and no templates, no library
> functions linked, no header files, etc etc....
>
> Will modern C systems handle this?
> [Probably not. Machine generated source code always seems to break
> compilers designed for code written by humans. -John]
We have been using C as intermediate language for the YAFL compiler,
and that has proven to be reasonably easy. It is also true that our
model is closer to C than yours: we have been able to define
functions, locals, we make extensive use of the preprocessor, our
loops translate into C loops, etc... See http://www.phidani.be/yafl
for more information. The underlying C compilers have seldom been a
true problem.
For more exotic models, you might have a look at Mercury (see
http://www.cs.mu.oz.au/research/mercury) that uses some of gcc's
subtleties to by pass the limitations of the common C model
(restrictions to local gotos, for instance). They do support plain C
as well by using a set of rather intricate preprocessor macros.
On the other hand, I am not sure this (I mean, using gcc's multiple
extensions) is much less work than actually writing a reasonably naive
code generator from scratch., while these extensions, by performing
operations on registers beyond gcc's control, might (no evidence)
limit gcc's ability to produce optimal code.
Well...
Darius.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.