From: Jacek Generowicz
Subject: C++2sexpr
Date: 
Message-ID: <tyfu1fihqg7.fsf@pcitapi22.cern.ch>
I would like to generate s-expressions representing the structure of
C++ code, automatically from the C++ source.

I think that I will only ever be interested in function signatures,
and class structure (i.e. not the code that does any actual
computation) ... IOW, I want to parse C++ header files, into
s-expressions.

As this is for a project at work (where currently nobody will be
prepared to pay for a commercial CL licence), I am restricted to using
the free CL implementations. Initial platform is Linux.

I am thinking of approaching this by using gccxml to do the parsing of
the C++ source code, and the XML utility in CLOCC/CLLIB to complete
the job.

Could you suggest alternative approaches which would be worth
considering?

From: Matthias Koeppe
Subject: Re: C++2sexpr
Date: 
Message-ID: <uw5ptq6zxdd.fsf@lambda.math.uni-magdeburg.de>
Jacek Generowicz <················@cern.ch> writes:

> I would like to generate s-expressions representing the structure of
> C++ code, automatically from the C++ source.
>
> I think that I will only ever be interested in function signatures,
> and class structure (i.e. not the code that does any actual
> computation) ... IOW, I want to parse C++ header files, into
> s-expressions. [...]
>
> I am thinking of approaching this by using gccxml to do the parsing of
> the C++ source code, and the XML utility in CLOCC/CLLIB to complete
> the job.
>
> Could you suggest alternative approaches which would be worth
> considering?

The current version of SWIG (http://www.swig.org) can also output its
parse tree of C++ header files in the form of CL s-expressions.

-- 
Matthias Koeppe -- http://www.math.uni-magdeburg.de/~mkoeppe
From: Thomas F. Burdick
Subject: Re: C++2sexpr
Date: 
Message-ID: <xcv65ryglmc.fsf@conquest.OCF.Berkeley.EDU>
Jacek Generowicz <················@cern.ch> writes:

> I would like to generate s-expressions representing the structure of
> C++ code, automatically from the C++ source.
> 
> I think that I will only ever be interested in function signatures,
> and class structure (i.e. not the code that does any actual
> computation) ... IOW, I want to parse C++ header files, into
> s-expressions.
> 
> As this is for a project at work (where currently nobody will be
> prepared to pay for a commercial CL licence), I am restricted to using
> the free CL implementations. Initial platform is Linux.
> 
> I am thinking of approaching this by using gccxml to do the parsing of
> the C++ source code, and the XML utility in CLOCC/CLLIB to complete
> the job.
> 
> Could you suggest alternative approaches which would be worth
> considering?

You might check out the Emacs package Semantic Bovinator, which has a
horrid name, but is a parser-generator for Emacs.  Someone might
already have it parsing C++.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Hannah Schroeter
Subject: Re: C++2sexpr
Date: 
Message-ID: <b1u6pn$eo7$2@c3po.schlund.de>
Hello!

Thomas F. Burdick <···@conquest.OCF.Berkeley.EDU> wrote:
>[...]

>You might check out the Emacs package Semantic Bovinator, which has a
>horrid name, but is a parser-generator for Emacs.  Someone might
>already have it parsing C++.

Might be, but you know that an exact and standard compliant parser
for C++ is *hard* to write.

Kind regards,

Hannah.
From: Jacek Generowicz
Subject: Re: C++2sexpr
Date: 
Message-ID: <tyf3cn0h5jl.fsf@pcitapi22.cern.ch>
······@schlund.de (Hannah Schroeter) writes:

> Might be, but you know that an exact and standard compliant parser
> for C++ is *hard* to write.

Right ... it is a job which I would only trust a C++ compiler to do.
So gccxml is appealing because it uses gcc as its front end, and as
all the code I would be working on must be gcc-compliant, I have a
high degree of certainty that gccxml would parse it correctly (or at
least in a way which we accept as correct :-).
From: Kalle Olavi Niemitalo
Subject: Re: C++2sexpr
Date: 
Message-ID: <87wukdgrac.fsf@Astalo.y2000.kon.iki.fi>
···@conquest.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> You might check out the Emacs package Semantic Bovinator, which has a
> horrid name, but is a parser-generator for Emacs.  Someone might
> already have it parsing C++.

It can't even parse function pointers in C.
http://sourceforge.net/tracker/?atid=117886&group_id=17886&func=browse