Re: Infinite look ahead required by C++?

Martin Ward <martin@gkc.org.uk>
Thu, 11 Feb 2010 12:20:42 +0000

          From comp.compilers

Related articles
[2 earlier articles]
Re: Infinite look ahead required by C++? idbaxter@semdesigns.com (Ira Baxter) (2010-02-06)
Re: Infinite look ahead required by C++? thurston@complang.org (Adrian Thurston) (2010-02-08)
Re: Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-09)
Re: Infinite look ahead required by C++? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-02-10)
Re: Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-10)
Re: Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-02-10)
Re: Infinite look ahead required by C++? martin@gkc.org.uk (Martin Ward) (2010-02-11)
Re: Infinite look ahead required by C++? idbaxter@semdesigns.com (Ira Baxter) (2010-02-13)
Re: Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-14)
Re: Infinite look ahead required by C++? wclodius@los-alamos.net (2010-02-13)
Re: Infinite look ahead required by C++? krzikalla@gmx.de (Olaf Krzikalla) (2010-02-19)
Re: Infinite look ahead required by C++? ng2010@att.net (ng2010) (2010-02-23)
Re: Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-02-27)
[2 later articles]
| List of all articles for this month |
From: Martin Ward <martin@gkc.org.uk>
Newsgroups: comp.compilers
Date: Thu, 11 Feb 2010 12:20:42 +0000
Organization: Compilers Central
References: 10-02-024 10-02-029
Keywords: C++
Posted-Date: 13 Feb 2010 11:32:53 EST

On Saturday 06 Feb 2010 18:37, you wrote:
> I really don't like the phrase "hard to parse", because it's relative
> to your parsing technology. GLR parsers are capable of parsing C++
> easily in spite of the ambiguous grammar.


"Hard to parse" has at least three different meanings:


(1) It's a lot of work to write a parser using the traditional parsing
technology (lex and yacc, or simple recursive descent). i.e. "This
nut is hard to crack using my old nutcrackes" In this sense, C++ is
definitiely "hard to parse".


(2) It's a lot of work to write a parser using *any* parsing
technology. This is the meaning which is relative to current parsing
technology. In this sense, C++ is not "hard to parse". (I can crack
this nut easily using my Acme Steam-Powered Sledgehammer :-))


(3) It's hard for *human beings* to parse this language. For example,
subtle ambiguities in the language mean that slight typos create a
progam which parses in a radically different way. Close and detailed
reading, combined with a detailed knoewledge of the intricacies of the
language syntax, are required for the human parser to parse the
language. In this sense, C++ is definitely "hard to parse"! Also, in
this sense, Scheme is "hard to parse" (at least, without some kind of
automated assistance for indenting and/or parentheses counting): even
though Scheme is trivally easy for a computer to parse.


--
Martin


STRL Senior Research Fellow and Royal Society Industry Fellow
martin@gkc.org.uk http://www.cse.dmu.ac.uk/~mward/ Erdos number: 4
G.K.Chesterton web site: http://www.cse.dmu.ac.uk/~mward/gkc/
Mirrors: http://www.gkc.org.uk and http://www.gkc.org.uk/gkc



Post a followup to this message

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