Related articles |
---|
[7 earlier articles] |
Re: C++ intermediate representation. gsc@zip.com.au (Sean Case) (2005-05-14) |
Re: C++ intermediate representation. robert.hundt@gmail.com (Robert H) (2005-05-15) |
Re: C++ intermediate representation. gdr@integrable-solutions.net (Gabriel Dos Reis) (2005-05-15) |
Re: C++ intermediate representation. mefrill@yandex.ru (2005-05-15) |
Re: C++ intermediate representation. comeau@panix.com (2005-05-15) |
Re: C++ intermediate representation. comeau@panix.com (2005-05-15) |
Re: C++ intermediate representation. comeau@panix.com (2005-05-15) |
Re: C++ intermediate representation. bjarne@gmail.com (bjarne) (2005-05-15) |
Re: C++ intermediate representation. cfc@shell01.TheWorld.com (Chris F Clark) (2005-05-16) |
Re: C++ intermediate representation. idbaxter@semdesigns.com (Ira Baxter) (2005-05-21) |
From: | comeau@panix.com (Greg Comeau) |
Newsgroups: | comp.compilers |
Date: | 15 May 2005 15:46:43 -0400 |
Organization: | Comeau Computing; http://www.comeaucomputing.com |
References: | 05-05-023 05-05-077 05-05-087 05-05-103 |
Keywords: | C++, parse |
Posted-Date: | 15 May 2005 15:46:43 EDT |
Chris F Clark <cfc@shell01.TheWorld.com> wrote:
>The one thing that surprises me, given Stroustrup's statement about
>building C++ with a yacc parser is how he made some of the design
>mistakes he did. The syntax that uses parenthesis for passing
>constructor arguments in a declaration, so that one cannot easily
>distinguish a declaration of a variable that has constructor arguments
>from a function prototype declaration is an example. That should have
>caused his tool to give him conflicts, indicating that he was
>wandering into an ambiguous grammar and should have found a different
>syntax. Problems like this are why I try to steer people away from
>hand-written recursive descent--one can easily write a parser that has
>inconsistent rules by hand, expecially when one is prototyping and
>adding extensions. The fact that Stroustrup was able to make the same
>mistakes with a tool worries me extremely.
I suspect you are relating unrelated aspect of Stroustrup's work, and
hence drawing wrong conclusions to which to be surprised about! :)
>[I think the problem is that yacc tells you there's a bunch of
>shift/reduce conflicts and then produces a parser anyway for a
>language not entirely different from the one in your grammar. Half
>the time the shift resolution is what you want, half the time it's
>not, but unless you understand LR parsing fairly well, it's hard to
>look at the yacc output file and figure out what the problem was and
>what it did. So it's tempting to hope that it's close enough and
>blunder on ahead. -John]
Perhaps. But as in my above remark, I doubt that's what happened
in Stroustrup's compiler.
--
Greg Comeau / Comeau for the Mac? Stay tuned.
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Return to the
comp.compilers page.
Search the
comp.compilers archives again.