From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11958 invoked by alias); 25 Oct 2004 22:44:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 11951 invoked from network); 25 Oct 2004 22:44:53 -0000 Received: from unknown (HELO lon-mail-2.gradwell.net) (193.111.201.126) by sourceware.org with SMTP; 25 Oct 2004 22:44:53 -0000 Received: from digraph.polyomino.org.uk [81.187.227.50] (user: postmaster2815c918op3.polyomino.org.uk) by lon-mail-2.gradwell.net with esmtp (Gradwell gwh-smtpd 1.147) id 417d81e1.b31f.86; Mon, 25 Oct 2004 23:44:49 +0100 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.42) id 1CMDa4-0003Mo-KU; Mon, 25 Oct 2004 22:44:48 +0000 Date: Mon, 25 Oct 2004 22:51:00 -0000 From: "Joseph S. Myers" X-X-Sender: jsm28@digraph.polyomino.org.uk To: Ziemowit Laski cc: gcc-patches@gcc.gnu.org Subject: Re: New C parser [patch] In-Reply-To: <42A6DEB0-26D4-11D9-9558-000D9330C50E@apple.com> Message-ID: References: <42A6DEB0-26D4-11D9-9558-000D9330C50E@apple.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2004-10/txt/msg02115.txt.bz2 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/ jsm@polyomino.org.uk (personal mail) joseph@codesourcery.com (CodeSourcery mail) jsm28@gcc.gnu.org (Bugzilla assignments and CCs)