This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New C parser [patch]


Joseph S. Myers wrote:

On Mon, 25 Oct 2004, Ziemowit Laski wrote:


I'm just curious as to why you think that writing a C parser from scratch is
easier than tweaking Mark's parser to handle C.


You have an interesting definition of "tweaking". Geoffrey Keating gave an estimate of 6-9 man-years to merge the front ends making them handle the present languages as fast as at present. This compares to 1 man-week to write a functional C parser for the exact present language accepted which also speeds up the compiler despite not having been profiled or tuned for performance at all.


To be fair though, Geoff's estimate accounted for merging a lot
of the semantic processing that continues to be semi-clones of
each other, and continues to cause performance problems that have
to be solved twice.

Even so, changing to a recursive descent parser is a step in the
right direction, because it will be easier to compare with the
C++ parser. And of course it's awesome that you did it in a week;
if you can do it that quickly, maybe it would only take you a
couple months to merge frontends! :-)

I'm asking because merging the front-ends would allow ObjC/ObjC++ to be
simplified _tremendously_: we will be able to utilize C++ machinery
to implement ObjC subclassing and access control, not to mention a
more sensible interaction of ObjC objects with C++ EH and RTTI.


Merging front ends provides only marginal maintenance benefits - a great many changes to a merged front end would need to consider their possible effects on many more different languages and language versions than at present, making the burden associated with making each change that much greater though maybe slightly reducing the number of changes to be made. C and C++ have been diverging for over 20 years; many similarities are only superficial and hide underlying differences and are dangerous to rely on if you want a correct compiler.



As I understand it, the C/C++ divergence is not something that
anyone really wants - not the language committees, not implementors,
and most especially not users, who just don't buy any of our
explanations - their atttitude is "You control the languages and the
compilers, who's stopping you from solving the problem!?". One of the
things I think we could be doing for the users is to exert our influence
on language committee people to cooperate better than they have been,
and to lead by example, in the way that GCC is implemented.

The attitude that C and C++ are diverging, and so we might as well
go along, seems kind of defeatist, and will just encourage more of
the very things that we don't want to happen (just imagine further
divergence requiring two different preprocessor libraries - bleah!).

Stan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]