caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: erayo@cs.bilkent.edu.tr
Cc: John Goerzen <jgoerzen@complete.org>,
	ronniec95@lineone.net, caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Efficient C++ interfacing?
Date: 07 Jun 2004 06:41:51 +1000	[thread overview]
Message-ID: <1086554511.16811.651.camel@pelican.wigram> (raw)
In-Reply-To: <200406062144.55004.exa@kablonet.com.tr>

On Mon, 2004-06-07 at 04:44, Eray Ozkural wrote:
> On Sunday 06 June 2004 10:00, skaller wrote:

> >
> > (1) Flxcc can't parse C++ yet
> 
> I had started writing a modern top-down C++ parser using the combinatorial 
> parser library Parsec in Haskell, but I had failed due to lack of time with 
> the project.

> There are freely available parser models [LL(k), not LR(k)] which 
> we can build upon. 

C++ *interfaces* can probably be parsed with LALR
tool like ocamlyacc. At least, I hope so!

The needs of a wrapper generator are considerably weaker
than a compiler. For example given the construction:

int x = expr;

we can parse 'expr' by as a list of tokens followed by semi.
We don't care about the RHS at all, we just need to know 'x'
is an 'int'.

Even if we can't quite parse everything, there are
ways a wrapper generator can handle that (eg just
ignore the declaration, and allow the user to fix
it by hand writing the wrapper for that function).

> > (2) Flxcc can't target Ocaml yet
> 
> This one wouldn't be hard.

I agree, but I haven't tried it.

> So, you do have a rudimentary C++ parser?

I have a sophisticated C parser (frontc/Cil)
which handles GNU and MSVC extensions.

Extending frontc to handle C++ seems easy.
Cil converts the representation to one
more amenable to analysis. Hacking Cil
to accept the new constructors is harder.
For example it checks for redeclarations 
of functions:

void f();
void f() { printf("Hello world"); }

and knows there are the same .. but of course
C++ allows overloading.

> > What's needed is developers.

> Yes. However, doing this wrapper generator is considerably valuable. 

I agree. It would be a great boost for Ocaml I think.
And Ocaml people helping get it to work will also be
helping it to work for Felix .. 

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-06-06 20:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-30  7:41 Brandon J. Van Every
2004-05-30 11:47 ` ronniec95
2004-05-30 20:17   ` Brandon J. Van Every
2004-06-05 16:45   ` Eray Ozkural
2004-06-05 19:07     ` skaller
2004-06-06  0:31       ` Eray Ozkural
2004-06-06  3:33         ` John Goerzen
2004-06-06  7:00           ` skaller
2004-06-06 16:02             ` David Fox
2004-06-06 18:44             ` Eray Ozkural
2004-06-06 20:41               ` skaller [this message]
2004-06-07  3:04                 ` Eray Ozkural
2004-06-07  7:41                   ` Benjamin Geer
2004-06-07 13:38                     ` Eray Ozkural
2004-06-07 14:18                     ` Basile Starynkevitch local
2004-06-07 14:29                       ` Eray Ozkural
2004-06-07 16:29                         ` Eray Ozkural
2004-06-07 15:46                   ` skaller
2004-06-06 16:00       ` David Fox
2004-06-05 21:39     ` Brandon J. Van Every
2004-06-06 16:18       ` David Fox
2004-06-06 18:47         ` Eray Ozkural

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=1086554511.16811.651.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=erayo@cs.bilkent.edu.tr \
    --cc=jgoerzen@complete.org \
    --cc=ronniec95@lineone.net \
    /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;
as well as URLs for NNTP newsgroup(s).