Related articles |
---|
[5 earlier articles] |
Re: Is C++ really used ? jlilley@empathy.com (John Lilley) (1997-05-04) |
Re: Is C++ really used ? dwight@pentasoft.com (1997-05-04) |
Re: Is C++ really used ? cdg@nullstone.com (Christopher Glaeser) (1997-05-04) |
Is C++ really used ? peter@bj-ig.de (Peter Brueckner) (1997-05-04) |
Re: Is C++ really used ? danwang@nordica.CS.Princeton.EDU (1997-05-07) |
Re: Is C++ really used ? kbreinho@bsquare.com (Keith L. Breinholt) (1997-05-08) |
Re: Is C++ really used ? geert@sun3.iaf.nl (1997-05-08) |
Re: Is C++ really used ? David.Monniaux@ens-lyon.fr (1997-05-08) |
Re: Is C++ really used ? chase@world.std.com (David Chase) (1997-05-08) |
Re: Is C++ really used ? clark@quarry.zk3.dec.com (1997-05-08) |
Re: Is C++ really used ? cliffc@risc.sps.mot.com (Cliff Click) (1997-05-08) |
Re: Is C++ really used ? nasser@apldbio.COM (Nasser Abbasi) (1997-05-08) |
Re: Is C++ really used ? shankar@chromatic.com (1997-05-08) |
[4 later articles] |
From: | geert@sun3.iaf.nl (Geert Bosch) |
Newsgroups: | comp.compilers |
Date: | 8 May 1997 21:15:46 -0400 |
Organization: | La Calandre Infortunee |
References: | 97-04-156 97-04-167 97-05-018 |
Keywords: | C++, practice |
John Lilley (jlilley@empathy.com) wrote:
``But the real question is "why isn't C++ used for *compilers*". I
offer that the main reason is portabilty. You must bootstrap the
compiler from an existing base. If the compiler is written in C++ and
you want it to be portable across several platforms, it is a nightmare
trying to reconcile the various flavors of C++ that abound. It is
also a bootstrapping problem, and it is more likely that you will
encounter a viable "C" compiler on whatever system than a viable C++
compiler.
My is verified by the approaches of GNU g++ (which has a mission of
being written only in "C"), and of Edison Design Group (who sell a
very-high-quality, portable C++ front-end written in "C").''
Although this example might sound reasonable, it is easy to provide a
strong counter example, which in fact is an argument for using C++ to
implement a C++ compiler.
The counter example is the GNU Ada (GNAT) compiler, which is written
using Ada-95. It uses the gcc backend just like the g++ compiler.
Originally there was a plan to be able to generate code for some
virtual machine or assembly-like (thus horribly inefficient) C code
for bootstrapping purposes.
It turned out that the cross-compiling capabilities of gcc where
adaquate for bootstrapping the compiler on a new platform. Only very
early in the development an existing Ada-83 compiler was used to
bootstrap GNAT. As soon as GNAT could compile itself the Ada-83
compiler was retired and the GNAT could use more new language
capabilities as they were implemented.
There are several reasons not to write an Ada or C++ compiler in
C. First a compiler for a complex language like Ada or C++ is a very
large and complex piece of software. The reason of the existance of
Ada and C++ is precisely because they are more suited for this kind of
software.
Another argument is that implementing a compiler in language X gives
the developers much experience in using language X for a complex piece
of software. When you implement X using language Y, I don't think that
is very good for the understanding of the use of X in actual projects.
I'd rather have a compiler for X developed by people that have
real-world experience with delivering complex software written in
X. When the developers *do* have this kind of experience, but choose
to use language Y anyway, I would wonder why I should use language X
for my own projects. (This assumes X and Y are both general purpose
languages, like C, C++ and Ada.)
Regards,
Geert
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.