Version française
Home     About     Download     Resources     Contact us    
Browse thread
Looking for full-fledged C++ Parser with OCAML interface
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gordon Henriksen <gordonhenriksen@m...>
Subject: Re: [Caml-list] Looking for full-fledged C++ Parser with OCAML interface
On 2008-03-07, at 08:54, Christopher L Conway wrote:

> On Fri, Mar 7, 2008 at 2:40 AM, Soonho Kong <soon@ropas.snu.ac.kr>  
> wrote:
>
>> Hello everyone. I'm a graduate student majoring in program  
>> analysis. I'm looking for a full-fledged C++ parser with OCAML  
>> interface. Is there a better candidate than Olmar? Please recommend  
>> one if anyone knows about it.
>
> Have you looked at LLVM? It does have OCaml bindings, although they  
> were only partial when last I looked.

LLVM's OCaml bindings are aimed at authoring front-ends (i.e., IR  
generation), and are reasonably complete from that perspective.

> I don't know "how fledged" their C++ parser is.

The LLVM project includes two C front-ends (separate projects).

llvm-gcc is a gcc branch maintained by the LLVM project. It is stable  
and complete, having successfully been used to compile very a large  
volume of C, C++ and Objective-C code. Unfortunately, GCC does not  
have a library-based design, so attaching to its parser would be very  
difficult.
clang is an entirely new compiler under development in the LLVM  
project. It only yet compiles C. Objective C is also parsed. clang has  
a library-based design that should make it very attractive for tools  
building. It is being designed to support such clients as refactoring  
and IDEs. It supports serializing the AST to disk, source rewriting,  
and incremental reparsing. Full C++ support has been estimated at 2  
years out.

So, looking for a C++ parser now for a research project, you probably  
won't find anything of value from the LLVM project. In the longer  
term, clang may be significantly interesting, not only because it has  
a library-based design, but also because it will be used in a first- 
class capacity (compiler, IDE) by a large vendor (Apple).

— Gordon