Version française
Home     About     Download     Resources     Contact us    
Browse thread
Best C parser to extend for Objective-C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Re: Best C parser to extend for Objective-C
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 <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net