Re: Parsing C++ Declarations

Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
20 Mar 2005 10:15:02 -0500

          From comp.compilers

Related articles
Parsing C++ Declarations blake.rain@gmail.com (HalfWayMan) (2005-03-18)
Re: Parsing C++ Declarations Brian.Inglis@SystematicSW.ab.ca (Brian Inglis) (2005-03-20)
Re: Parsing C++ Declarations drdiettrich@compuserve.de (DrDiettrich) (2005-03-20)
| List of all articles for this month |

From: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Newsgroups: comp.compilers
Date: 20 Mar 2005 10:15:02 -0500
Organization: Systematic Software
References: 05-03-069
Keywords: C++, parse
Posted-Date: 20 Mar 2005 10:15:02 EST

On 18 Mar 2005 00:47:53 -0500 in comp.compilers, "HalfWayMan"
<blake.rain@gmail.com> wrote:


>I have been writing compilers for some time now, but one thing that
>always seems to bug me is parsing of C and C++ declarations. Perhaps
>it's not the parsing that I have the problem with, more the
>representation of the declaration afterwards. In a current project I
>am representing declarations as a list of either specifiers or
>declarators. However, this leads to problems and holes in type
>comparisons and conversion. I was wondering if any of you knew of an
>elegent way of representing this information.
>
>Perhaps I'm doing it all wrong. It would be a shame.


Studying an implementation of cdecl and c++decl, which enumerates all
the parts, but does not define all the properties, may help:
ftp://sunsite.unc.edu/pub/Linux/devel/lang/c/cdecl-2.5.tar.gz but
don't forget about such things as incomplete types and tentative
definitions. Some scanning of comp.std.c for thread topics about
definitions and declarations may also help. And you could look at the
GCC front ends for C and C++.


--
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada


Brian.Inglis@CSi.com (Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca)
        fake address use address above to reply



Post a followup to this message

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