>
> Dear all.
Hi,
>
> Is there anybody knowing about existing C++ parser that is not so big?
>
> I've already know EDG and ELSA.
> But they are so big and hard to see.
> I don't want a perfect C++ parser.
> If it can parse common and simple C++, that's OK.
There is one here:
http://padator.org/software/project-yacfe/yacfe-light-0.3.tgz
but it's not really complete.
Once built, you can test it with
./yacfe -parse_c++ foo.cpp
>
> I need your advice.
>
> Thank you.
> --
> Kihong Heo.
>
>
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
There's clang which is part of the LLVM project. Not sure how easy/
hard it is to use. I'd guess most any parser that could parse C++
would be "big" and probably difficult to use... clang's C++ support
isn't complete yet (is any C++ parser complete?), but they do seem to
be making progress and it's probably about on par with ELSA.
http://clang.llvm.org/
The perfect C++ parser: GCC XML. I thing that there is an OCaml binding
to it.
Otherwise, depending on what you want to do, there is Swig. It parses
only C++ declarations.
> I need your advice.
For a new project, I'd use GCC XML.
> Thank you.
> --
> Kihong Heo.
All the best,
--
Guillaume Yziquel
http://yziquel.homelinux.org/
[[sorry for this reply, which is barely related to Ocaml, but may be of interest to several Ocaml fans interested in C++
analysis]]
There is however a small caveat. AFAIK, GCC XML is not much maintained, and depends upon an old GCC version (but I might
be wrong on both points). Latest release of GCC XML seems to be 0.6 from february 2004.
Next (4.5.0) release of GCC will provide two major new features: link time optimization [=LTO] & plugins.
Both features are useful for any kind of C++ static analysis programs; a plugin can define new passes, and the LTO
feature enable them to be run at "link" time, that is to merge information from several compilation units. And indeed
GCC have powerful & common internal representations of the compiled source code, which is the same for C, C++, Fortran,
Ada, Java .. source inputs to GCC.
So one could consider coding a plugin for GCC which extracts the exact information required by your (Ocaml) static
analyser. In addition (sorry for the shameless self-promotion), if you like functional programming, you might even code
your plugin as a MELT module. MELT is a plugin (written by me) which enables you to express your GCC pass in a
higher-level Lisp-like mostly dynamic language (with closures, powerful pattern matching [in particular pattern matching
on GCC internal representations like Gimple], objects - but unfortunately no static typing with type inference).
Feel free to ask me more (preferably off list, or preferably on the g...@gcc.gnu.org list) about MELT.
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***
>
> Kihong Heo a �crit :
>> Dear all.
>> Is there anybody knowing about existing C++ parser that is not so big?
>> I've already know EDG and ELSA.
>> But they are so big and hard to see. I don't want a perfect C++ parser.
>> If it can parse common and simple C++, that's OK.
>
> The perfect C++ parser: GCC XML.
From the FAQ they say:
"Why are C++ function bodies not dumped in XML?
The original sponsors of the project had no need for function bodies. So far the authors have not had time or funding to implement the support. Contact the mailing list if you are interested in contributing this support or providing funding to have it implemented. "
is it still true ?
Also do they maintain comments, space, positions, cpp directives ?
If you need to do source-to-source transformation, e.g. refactoring,
you need those things.
> I thing that there is an OCaml binding to it.
>
is it this one?:
http://qt-caml.crapulion.org/trac/browser/trunk/src/gccxml/lib