Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Calling Ocaml from Python
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Max Powers <max_powers280@h...>
Subject: [Caml-list] Calling Ocaml from Python
This is a bit of a repeat of a question that I posted to comp.lang.python 
(sorry to anyone who was there too!). I'm looking for some advice on 
integrating a python GUI with an OCaml library. (Note: I'm fairly new to 
both ocaml and python; more of a perl and c++ programmer!)

Basically the story is this, I'm building a GUI on the front of an existing 
OCaml tool. I'm writing the GUI in wxPython (there are a number of reasons 
why, I investigated various caml gui toolkits and unfortunately they didn't 
quite satisfy the requirements I had). Currently the GUI is envisaged as a 
glorified configuration file editor; it should help users to generate 
configuration files that are then handed to the ocaml tool to execute.

The problem is this, both the python GUI and the ocaml tool need to know how 
to parse/understand the configuration file format, and I'd like to write the 
parser once (in ocaml, using ocamllex/yacc probably) and use it twice (in 
the GUI and the base tool). My challenge now is to figure out how to call 
the ocaml parser library from python.

I currently have two possibilities in mind. Surfing the web uncovered 
Pycaml, which suggests integration both ways, however from the examples I 
only understand how python can be called from ocaml (not the other way).

The second possibility is to wrap the ocaml module in a c library that can 
then be imported into the python code.

What I'm hoping is that someone on the list has tried this sort of thing 
before and can give a little advice on the best way forwards (and hopefully 
reduce the number of blind alleys I explore!).

Thanks,
Max
(sorry for the length of the message and any abuse of the nomenclature!)

_________________________________________________________________
Personalise your phone with chart ringtones and polyphonics. Go to  
http://ringtones.com.au/ninemsn/control?page=/ninemsn/main.jsp

-------------------
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