caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Best C parser to extend for Objective-C
@ 2007-09-06 20:56 Joel Reymont
  2007-09-06 23:21 ` Joel Reymont
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Reymont @ 2007-09-06 20:56 UTC (permalink / raw)
  To: Caml List

I made good progress recently with my Cocoa bridge for Lisp and I'm  
emboldened to start on the OCaml version. I would like to use a  
parser for header files to build wrappers for Cocoa classes by first  
building up the OCaml AST and then pretty-printing it.

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.

I want to grab a parser, add the Objective-C grammar and run the  
result over Cocoa headers. What would be the best parser code base to  
start with?

	Thanks, Joel

--
http://wagerlabs.com






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

* Re: Best C parser to extend for Objective-C
  2007-09-06 20:56 Best C parser to extend for Objective-C Joel Reymont
@ 2007-09-06 23:21 ` Joel Reymont
  2007-09-07  2:47   ` [Caml-list] " skaller
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Reymont @ 2007-09-06 23:21 UTC (permalink / raw)
  To: Caml List

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.

--
http://wagerlabs.com






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

* Re: [Caml-list] Re: Best C parser to extend for Objective-C
  2007-09-06 23:21 ` Joel Reymont
@ 2007-09-07  2:47   ` skaller
  0 siblings, 0 replies; 3+ messages in thread
From: skaller @ 2007-09-07  2:47 UTC (permalink / raw)
  To: Joel Reymont; +Cc: Caml List

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


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

end of thread, other threads:[~2007-09-07  2:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-06 20:56 Best C parser to extend for Objective-C Joel Reymont
2007-09-06 23:21 ` Joel Reymont
2007-09-07  2:47   ` [Caml-list] " skaller

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