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 HAA17920; Thu, 29 Apr 2004 07:07:10 +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 HAA17929 for ; Thu, 29 Apr 2004 07:07:09 +0200 (MET DST) Received: from hotmail.com (bay9-f62.bay9.hotmail.com [64.4.47.62]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i3T577jq024223 for ; Thu, 29 Apr 2004 07:07:08 +0200 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 28 Apr 2004 22:07:07 -0700 Received: from 192.174.21.220 by by9fd.bay9.hotmail.msn.com with HTTP; Thu, 29 Apr 2004 05:07:07 GMT X-Originating-IP: [192.174.21.220] X-Originating-Email: [max_powers280@hotmail.com] X-Sender: max_powers280@hotmail.com From: "Max Powers" To: skaller@users.sourceforge.net Cc: caml-list@inria.fr Subject: Re: [Caml-list] Calling Ocaml from Python Date: Thu, 29 Apr 2004 14:37:07 +0930 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 29 Apr 2004 05:07:07.0119 (UTC) FILETIME=[D18577F0:01C42DA7] X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 python:01 2004:99 swig:01 swig:01 antlr:01 python:01 structs:01 50,000:99 ocaml:01 ocaml:01 280:98 trivial:01 click:97 parser:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >On Thu, 2004-04-29 at 13:49, skaller wrote: > >There is an Ocaml module in SWIG which may be useful to you. Hmmm, forgive me if I'm totally off base with this, but I thought that SWIG was used to interface a C library to other languages. I.e. I can use SWIG to generate an interface to a c library so I can use that from Ocaml, rather than generating an interface to expose Ocaml functions to a C (or other) program. That reveals another option that I'd missed, I can write the parser in C (using the normal lex/yacc or even ANTLR!) and then provide both a python and Ocaml interface to that library. >It sounds like you basically only need to call a single >Ocaml parser function from Python to do the parsing which >should be trivial. Yeah, I think you're right (i.e. I think I can write the parser in Ocaml if required and it will be fairly simple). What I'm having trouble understanding is how to call the Ocaml function from python (i.e. how do I call any ocaml library function from python?). >More difficult will be interpreting the parser output: >that will be some Ocaml data structure like a parse tree >you'll need to walk somehow from Python. > >On way to do that might be to get the Ocaml parse to >build a parse tree made out of PyObjects. Hmmm, very good point. Haven't thought about that yet... (I've got the feeling/hope that the output from the parser won't be too complex - should just be a few structs - after all, it's only a configuration file!). Thanks for the help so far, Max _________________________________________________________________ SEEK: Now with over 50,000 dream jobs! Click here: http://ninemsn.seek.com.au?hotmail ------------------- 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