From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA20485; Sun, 6 Jun 2004 22:42:16 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA20329 for ; Sun, 6 Jun 2004 22:42:15 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i56KgCEV017479 for ; Sun, 6 Jun 2004 22:42:13 +0200 Received: from [192.168.1.200] (ppp114-11.lns1.syd3.internode.on.net [150.101.114.11]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i56KfvHY071528; Mon, 7 Jun 2004 06:12:00 +0930 (CST) Subject: Re: [Caml-list] Efficient C++ interfacing? From: skaller Reply-To: skaller@users.sourceforge.net To: erayo@cs.bilkent.edu.tr Cc: John Goerzen , ronniec95@lineone.net, caml-list In-Reply-To: <200406062144.55004.exa@kablonet.com.tr> References: <40800C10000A6ABC@mk-cpfrontend-4.mail.uk.tiscali.com> <20040606033327.GA23341@complete.org> <1086505241.16811.625.camel@pelican.wigram> <200406062144.55004.exa@kablonet.com.tr> Content-Type: text/plain Message-Id: <1086554511.16811.651.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 07 Jun 2004 06:41:51 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 40C381A4.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 interfacing:01 sourceforge:01 2004:99 44,:01 eray:01 ozkural:01 2004:99 00,:99 haskell:01 lalr:01 expr:01 'int':01 frontc:01 frontc:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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