caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* C++ parser
@ 2010-01-14 11:36 Kihong Heo
  2010-01-14 19:58 ` [Caml-list] " Yoann Padioleau
  2010-01-17 16:16 ` Guillaume Yziquel
  0 siblings, 2 replies; 5+ messages in thread
From: Kihong Heo @ 2010-01-14 11:36 UTC (permalink / raw)
  To: caml-list

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.

I need your advice.

Thank you.
--
Kihong Heo.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] C++ parser
  2010-01-14 11:36 C++ parser Kihong Heo
@ 2010-01-14 19:58 ` Yoann Padioleau
  2010-01-17 16:16 ` Guillaume Yziquel
  1 sibling, 0 replies; 5+ messages in thread
From: Yoann Padioleau @ 2010-01-14 19:58 UTC (permalink / raw)
  To: Kihong Heo; +Cc: caml users, Cocci List


On Jan 14, 2010, at 3:36 AM, Kihong Heo wrote:

> 
> 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
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] C++ parser
  2010-01-14 11:36 C++ parser Kihong Heo
  2010-01-14 19:58 ` [Caml-list] " Yoann Padioleau
@ 2010-01-17 16:16 ` Guillaume Yziquel
  2010-01-17 19:15   ` Basile STARYNKEVITCH
  2010-01-17 19:16   ` Yoann Padioleau
  1 sibling, 2 replies; 5+ messages in thread
From: Guillaume Yziquel @ 2010-01-17 16:16 UTC (permalink / raw)
  To: Kihong Heo; +Cc: caml-list

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. 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/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] C++ parser
  2010-01-17 16:16 ` Guillaume Yziquel
@ 2010-01-17 19:15   ` Basile STARYNKEVITCH
  2010-01-17 19:16   ` Yoann Padioleau
  1 sibling, 0 replies; 5+ messages in thread
From: Basile STARYNKEVITCH @ 2010-01-17 19:15 UTC (permalink / raw)
  To: guillaume.yziquel; +Cc: Kihong Heo, caml-list

Guillaume Yziquel wrote:
> 
> For a new project, I'd use GCC XML.

[[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 gcc@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} ***


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] C++ parser
  2010-01-17 16:16 ` Guillaume Yziquel
  2010-01-17 19:15   ` Basile STARYNKEVITCH
@ 2010-01-17 19:16   ` Yoann Padioleau
  1 sibling, 0 replies; 5+ messages in thread
From: Yoann Padioleau @ 2010-01-17 19:16 UTC (permalink / raw)
  To: guillaume.yziquel; +Cc: Kihong Heo, caml-list

[-- Attachment #1: Type: text/plain, Size: 1683 bytes --]


On Jan 17, 2010, at 8:16 AM, Guillaume Yziquel wrote:

> 
> 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


> 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/
> 
> _______________________________________________
> 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
> 


[-- Attachment #2: Type: text/html, Size: 2816 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-17 19:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-14 11:36 C++ parser Kihong Heo
2010-01-14 19:58 ` [Caml-list] " Yoann Padioleau
2010-01-17 16:16 ` Guillaume Yziquel
2010-01-17 19:15   ` Basile STARYNKEVITCH
2010-01-17 19:16   ` Yoann Padioleau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).