From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 9482DBBAF for ; Sun, 17 Jan 2010 20:15:42 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnECAFHwUks+BBFke2dsb2JhbACBRoIbmCIBARYkA6stjCOBLIIwVgQ X-IronPort-AV: E=Sophos;i="4.49,292,1262559600"; d="scan'208";a="54181791" Received: from smtp-100-sunday.noc.nerim.net (HELO mallaury.nerim.net) ([62.4.17.100]) by mail4-smtp-sop.national.inria.fr with ESMTP; 17 Jan 2010 20:15:42 +0100 Received: from hector.lesours (ours.starynkevitch.net [213.41.244.95]) by mallaury.nerim.net (Postfix) with ESMTP id 82B8CA1056; Sun, 17 Jan 2010 20:15:39 +0100 (CET) Received: from glinka.lesours ([192.168.0.1]) by hector.lesours with esmtp (Exim 4.71) (envelope-from ) id 1NWab6-0002OB-MP; Sun, 17 Jan 2010 20:15:40 +0100 Message-ID: <4B5361DC.9040402@starynkevitch.net> Date: Sun, 17 Jan 2010 20:15:40 +0100 From: Basile STARYNKEVITCH User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: guillaume.yziquel@citycable.ch Cc: Kihong Heo , caml-list@inria.fr Subject: Re: [Caml-list] C++ parser References: <30315E42-6659-4B43-B27B-13823B1C924B@ropas.snu.ac.kr> <4B5337D5.7010003@citycable.ch> In-Reply-To: <4B5337D5.7010003@citycable.ch> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; basile:01 basile:01 parser:01 guillaume:01 gcc:01 ocaml:01 ocaml:01 afaik:01 gcc:01 compilation:01 inputs:01 higher-level:01 inference:01 faiencerie:01 92340:01 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: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} ***