Browse thread
[Caml-list] Efficient C++ interfacing?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-06-06 (20:42) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] Efficient C++ interfacing? |
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