Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2004-04-29 (14:17)
From: John Goerzen <jgoerzen@c...>
Subject: Re: [Caml-list] Calling Ocaml from Python
On Thu, Apr 29, 2004 at 12:39:24PM +0930, Max Powers wrote:
> 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.

How about not writing a parser at all?  In Python, use ConfigParser, and
in OCaml, use, erm, ConfigParser! :-)  (See  BTW, the ConfigParser in missinglib
will shortly have string interpolation in the same manner as Python has.

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

Hmm... what makes that a problem for you?  (What specifically are you
trying to do that requires you to call OCaml from Python?)

-- John

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: