Re: simple vs. complex parsers

bs@research.att.com (Bjarne Stroustrup)
23 May 2003 01:38:18 -0400

          From comp.compilers

Related articles
[11 earlier articles]
Re: simple vs. complex parsers bobduff@shell01.TheWorld.com (Robert A Duff) (2003-05-15)
Re: simple vs. complex parsers cfc@shell01.TheWorld.com (Chris F Clark) (2003-05-18)
Re: simple vs. complex parsers schmitz@essi.fr (Sylvain Schmitz) (2003-05-18)
Re: simple vs. complex parsers mal@wyrd.be (Lieven Marchand) (2003-05-18)
Re: simple vs. complex parsers bs@research.att.com (2003-05-18)
Re: simple vs. complex parsers nmm1@cus.cam.ac.uk (2003-05-23)
Re: simple vs. complex parsers bs@research.att.com (2003-05-23)
Re: simple vs. complex parsers antkaij@mit.jyu.fi (Antti-Juhani Kaijanaho) (2003-05-24)
| List of all articles for this month |
From: bs@research.att.com (Bjarne Stroustrup)
Newsgroups: comp.compilers
Date: 23 May 2003 01:38:18 -0400
Organization: http://groups.google.com/
References: 03-02-125 03-02-147 03-03-043 03-03-061 03-03-103 03-04-006 03-04-028 03-04-046 03-04-066 03-04-116 03-05-103 03-05-145 03-05-162
Keywords: C++, history
Posted-Date: 23 May 2003 01:38:18 EDT

Moderator:
> [If you used yacc, how'd you end up with ambiguous syntax? -John]


When I wrote the first C++ grammar, I based it on the then current C
grammar. That grammar didn't even handle cases such as int(a);
correctly and it was "well known" around the Lab that C couldn't be
expressed using a LR(1) grammar. Together with Steve Johnson, the
inventor of YACC, I spent significant time trying to find a
close-to-C-compatible and unambiguous LR(1) for C++, but we couldn't
because of those problem with the C grammar. I didn't feel good about
adding another ambiguity requiring semantic resolution, but at least I
didn't add a problem that wasn't already in C. ... Then, the year
after, Tom Penello managed to express the C grammar as LR(1).


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.