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?
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
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! |
/ / `-----------------------'
( -. |
| ) |
(`-. '--.)
`. )----'
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.
······@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 :-).
···@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