Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Max Powers" <max_powers280@hotmail.com>
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	[thread overview]
Message-ID: <BAY9-F62flz4RZo09mp00016379@hotmail.com> (raw)

>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


             reply	other threads:[~2004-04-29  5:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-29  5:07 Max Powers [this message]
2004-04-29  5:33 ` skaller
  -- strict thread matches above, loose matches on Subject: below --
2004-04-30  1:13 Max Powers
2004-04-29  7:42 Max Powers
2004-04-29  5:58 Max Powers
2004-04-29  6:56 ` skaller
2004-04-29 21:24 ` art yerkes
2004-04-29  3:09 Max Powers
2004-04-29  3:49 ` skaller
2004-04-29  5:45 ` Basile STARYNKEVITCH
2004-04-29 14:16 ` John Goerzen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY9-F62flz4RZo09mp00016379@hotmail.com \
    --to=max_powers280@hotmail.com \
    --cc=caml-list@inria.fr \
    --cc=skaller@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox