From: | George Neuner <gneuner2@comcast.net> |
Newsgroups: | comp.compilers |
Date: | Tue, 19 May 2009 13:39:03 -0400 |
Organization: | A noiseless patient Spider |
References: | 09-05-080 |
Keywords: | practice |
Posted-Date: | 19 May 2009 14:01:09 EDT |
On Tue, 19 May 2009 04:01:26 -0700 (PDT), armencho@gmail.com wrote:
>What is the importance with a compiler that is able to compile itself?
>... a C/C++ compiler may be written in Java and so will at most be
>compiled by a Java compiler, and vice versa ...
>... Also, assemblers do not assemble themselves for the most part ...
The easiest way to get a compiler onto a new architecture is to
cross-compile it from an existing machine. Ditto assemblers.
Obviously, you can write a compiler in any suitable language, but
there can be a high cost in complexity - an impedance mismatch - when
the implementation language is very different from the language being
compiled. Some modern high level languages, in particular the group
of functional languages, have features and semantics which can be
difficult and inefficient to translate into the more traditional,
imperative, implementation languages like C (and C++, C#, Java, etc.
They are no more advanced than C despite hype to the contrary).
For this reason there is a tradition of writing compilers in their own
target source language (once the first compiler has been written, of
course). Beside which, a compiler is typically a large, non-trivial
application - so, naturally, along with the language validation suite
(if there is one), one of the first big tests of your new compiler is
whether it can compile itself.
George
Return to the
comp.compilers page.
Search the
comp.compilers archives again.