This is the mail archive of the
mailing list for the GCC project.
Re: A FrontEnd in C++?
On Mon, Aug 19, 2002 at 11:14:08AM +0200, Gabriel Dos Reis wrote:
> | Based on the number of problems we have encountered with the Ada front
> | end compared to the others, I think that as a matter of project policy
> | writing front ends in any language other than C should be discouraged.
> It is far from clear that those problems aren't deficiencies in the
> GCC's own architecture; any project that would make it possible to use
> the targetted language as an implementation language for front-ends
> should be highly encouraged IMSHO.
It seems that many people are more sanguine about allowing front ends
to be written in their own languages than I am. I didn't properly
explain why I don't like the idea; let me try again.
There is an intrinsic complexity burden to maintaining a program with
components written in multiple languages. You have to have a
functional compiler and runtime library for each source language, for
starters. On top of that, all the languages have to be ABI
compatible; historically, very little effort has been put into
maintaining that compatibility (beyond what is needed to interface the
language runtime to the system), so it is not a thing to be relied on.
Bugs due to deficiencies in the bootstrap compilers, or due to
cross-language ABI incompatibilities, are guaranteed to be hard to
find, since all the source code may be correct.
Never mind any additional burden due to deficiencies in GCC's
architecture, which there certainly are (all the C-specific stuff that
has to be stubbed out in other front ends, comes to mind). Even if
all those problems were addressed, the intrinsic difficulties of
maintaining a program written in multiple languages would remain. It
is my opinion that these intrinsic difficulties are *all by
themselves* sufficiently bad that we should avoid writing new code in
languages other than the currently predominant one, i.e. C.
I raised the Ada front end as an example, since it is the only front
end written in its own language currently present in the official GCC
tree. I am certain that (for instance) a C++ front end written in C++
would have the same sorts of problems. Robert Dewar asserts that
there have been no serious problems with the Ada front end - I would
like to remind him of the large number of "failure to bootstrap with
Ada enabled" PRs currently sitting unaddressed in GNATS: 6016, 6160,
6552, 6573, 6584, 6661, 6669, 6696, 6767, 6816, 6851, 6852, 6853,
6872, 6879, 6931, 6942, 7209, and 7337. This is one way the intrinsic
complexity burden manifests itself - there are only a few people who
understand Ada well enough to fix bugs in the Ada front end.
I am not a priori opposed to reworking the *entire compiler* in a
different language, although I think there are better things we could
be spending our time on.