From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id CEBE5BC6B for ; Fri, 7 Sep 2007 04:47:51 +0200 (CEST) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l872lntP025553 for ; Fri, 7 Sep 2007 04:47:50 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAFZX4EZ5LFL5/2dsb2JhbAAM X-IronPort-AV: E=Sophos;i="4.20,219,1186324200"; d="scan'208";a="183183908" Received: from ppp121-44-82-249.lns10.syd6.internode.on.net (HELO [192.168.1.201]) ([121.44.82.249]) by ipmail02.adl2.internode.on.net with ESMTP; 07 Sep 2007 12:17:48 +0930 Subject: Re: [Caml-list] Re: Best C parser to extend for Objective-C From: skaller To: Joel Reymont Cc: Caml List In-Reply-To: References: <1B6F3078-704B-4C4A-8BE1-B14705E2B256@gmail.com> Content-Type: text/plain Date: Fri, 07 Sep 2007 12:47:46 +1000 Message-Id: <1189133266.6596.29.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 46E0BBD5.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; parser:01 0100,:01 ffi:01 ffi:01 wrappers:01 parser:01 ocaml:01 usr:01 annotations:01 ocamlyacc:01 ocaml:01 forklift:98 2007,:98 forklift:98 sourceforge:01 On Fri, 2007-09-07 at 00:21 +0100, Joel Reymont wrote: > I must be dumb, FFI is indeed what I would be creating. Should I > start with ForkLift then? > > On Sep 6, 2007, at 9:56 PM, Joel Reymont wrote: > > > I understand that there are ForkLift and CIL but it seems to me > > that FL is more for generating FFI wrappers whereas I just need a > > parser. I'm not familiar with CIL. If you want to struggle through it: there is a CIL based wrapper generator already for Felix. Clearly, you'd need to replace the code that generates Felix with code that generates two files: an Ocaml file with the 'extern' and 'type' definitions, and a C file containing the glue logic. My wrapper flxcc is a batch processor. It uses a control file to parse and wrap complete systems, for example, it was designed to wrap the WHOLE of /usr/include in a single pass, with a few annotations in the control file. The problem wrapping C is that you have process everything, including all extremely non-conformant and weirdly structured GNU system headers. You cannot wrap just a single file, because it is too hard parse it with a LA(k) parser like Ocamlyacc. It MAY be possible to do this with a GLR parser eg Dypgen. Oh .. that is the EASY part... then you have to generate the glue logic. For Felix that isn't too hard because it is basically just a front end for C++ .. I think you'll find doing this for Ocaml is fairly daunting. -- John Skaller Felix, successor to C++: http://felix.sf.net