This is the mail archive of the
mailing list for the GCC project.
Re: New C parser [patch]
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. (If I made c_parser_error ignore the passed
diagnostic and just say "syntax error", I wouldn't be surprised if there
are no, or very few, testsuite regressions remaining.) A parser for C
being much simpler than for C++ also makes the assurance from reading the
code that it does actually parse the correct language rather better than
for a parser trying to parse two very different languages. (Though for
additional assurance that the language hasn't changed with the C parser -
that it parses the exact same GNU C as before, good or bad - I expect to
produce testcases totalling many times longer than the parser itself.)
I look forward to seeing your merged front end that has no testsuite or
performance regressions (save testcases that have been analysed and found
to have different but not inferior diagnostics) on either language. If
you are to show that this is easier than writing a C parser from scratch,
your merged front end should be ready within the next 168 hours.
> 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.
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
firstname.lastname@example.org (personal mail)
email@example.com (CodeSourcery mail)
firstname.lastname@example.org (Bugzilla assignments and CCs)