Re: parsing C and C++, Generating a simple hand-coded like

"Derek M. Jones" <derek@knosof.co.uk>
22 Dec 2006 01:09:40 -0500

          From comp.compilers

Related articles
[6 earlier articles]
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-12-16)
Re: Generating a simple hand-coded like recursive descent parser bobduff@shell01.TheWorld.com (Robert A Duff) (2006-12-17)
Re: Generating a simple hand-coded like recursive descent parser cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-19)
Re: parsing C and C++, Generating a simple hand-coded like gneuner2/@comcast.net (George Neuner) (2006-12-21)
Re: parsing C and C++, Generating a simple hand-coded like cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like derek@knosof.co.uk (Derek M. Jones) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like ik@unicals.com (Ivan A. Kosarev) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like derek@_NOSPAM_knosof.co.uk (Derek M. Jones) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-23)
Re: parsing C and C++, Generating a simple hand-coded like derek@knosof.co.uk (Derek M. Jones) (2006-12-24)
Re: parsing C and C++, Generating a simple hand-coded like cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-24)
| List of all articles for this month |
From: "Derek M. Jones" <derek@knosof.co.uk>
Newsgroups: comp.compilers
Date: 22 Dec 2006 01:09:40 -0500
Organization: ntl Cablemodem News Service
References: 06-09-029 06-09-042 06-09-048 06-09-060 06-09-078 06-09-093 06-12-064 06-12-066 06-12-076 06-12-078
Keywords: C, C++, parse
Posted-Date: 22 Dec 2006 01:09:40 EST

George,


> Note that I am in no way championing this style of compiler design,
> and I have never written a C or C++ compiler ... most of my work has
> been in scripting DSLs, Lisp and Pascal derivatives ... but, to date,
> I haven't encountered any language syntax ambiguities that I believed
> could not be resolved after parsing was complete.


If you are willing to accept multiple parse trees for the same
token sequence it is always possible to 'successfully' parse
a language.


I have a parser for C that does not use any symbol table. The most
common ambiguous parse is:


f(i); // function taking one argument, or perhaps
                // a declaration of i to have type f with redundant ()


I am currently working on a C++ parser. The main problem with
C++ is that there are a lot more constructs that lead to an
ambiguous parse.


I know of at least one other tool vendor who fully parses C/C++ source
using syntax information only, before building a symbol table.


Post a followup to this message

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