From: skaller <skaller@users.sourceforge.net>
To: Joel Reymont <joelr1@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: Best C parser to extend for Objective-C
Date: Fri, 07 Sep 2007 12:47:46 +1000 [thread overview]
Message-ID: <1189133266.6596.29.camel@rosella.wigram> (raw)
In-Reply-To: <C9E49AF3-2C0A-4475-B036-F3116BCB2EF2@gmail.com>
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
prev parent reply other threads:[~2007-09-07 2:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-06 20:56 Joel Reymont
2007-09-06 23:21 ` Joel Reymont
2007-09-07 2:47 ` skaller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1189133266.6596.29.camel@rosella.wigram \
--to=skaller@users.sourceforge.net \
--cc=caml-list@inria.fr \
--cc=joelr1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox