[Prev][Next][Index][Thread]
Re: [ANN] First alpha release of d2c CodeWarrior plugin available
In article <Sf9P4.897$oT4.111564@news.uswest.net>, "Shawn"
<shawn@anarchy-arts.com> wrote:
> Just curious, why do we need to go from Dylan to C ?
For the same reason that there exist compilers for C++, FORTRAN, Ada,
Scheme, Eiffel (and many other languages) that produce output in C rather
than in machine code or assembly language:
- it's easier
- every machine in the world has a C compiler
- you don't need to worry about instruction set styles and encodings and
register architectures on jillions of different machines (or even on one)
- you don't need to worry about instruction selection and scheduling and
so forth either.
- you don't need to worry about runtime conventions such as how to call
functions and which registers to save and so forth
- you don't have to worry about how to call OS functions and standard libraries
The C compiler already knows all that stuff. Someone worked hard on it.
> I would think C/C++ to Dylan would be more useful ? Can this take C
> and go the other way ?
The C output isn't intended to be human-readable (although d2c takes some
care to preserve function and variable names etc in the generated code --
much better than, say, CFront -- the original C++ compiler -- did).
You don't use d2c to convert your Dylan program to C and then work on it
some more in C. You program in Dylan. d2c compiles Dylan into C, and
then automatically calls the C compiler to produce a runnable program.
You usually never even look at the C code.
The problem of taking a program in one language and turning it into a
human readable, idiomatic, maintainable program in another programming
language is a *much* harder one. Well beyond the current state of the
art, I'd say.
-- Bruce
Follow-Ups:
References: