key Log In or Register

big tits
big tits
al-ama
al-ana
al-asi
al-bbw
al-bds
al-blo
al-boo
al-ebo
al-foo
al-gro
al-gy
al-han
al-har
al-int
al-lat
al-les
al-mat
al-mil
al-pan
al-par
al-pis
al-shm
al-tee
al-voy
ce-ama
ce-ana
ce-asi
ce-bbw
ce-bds
ce-blo
ce-boo
ce-ebo
ce-gy
ce-har
ce-int
ce-lat
ce-les
ce-mat
ce-mil
ce-pan
ce-pis
ce-shm
ce-tee
ce-voy
vi-ama
vi-ana
vi-ani
vi-asi
vi-bbw
vi-bds
vi-blo
vi-boo
vi-ebo
vi-foo
vi-gro
vi-gy
vi-han
vi-har
vi-inc
vi-int
vi-lat
vi-les
vi-mat
vi-mil
vi-pan
vi-par
vi-pis
vi-shm
vi-tee
vi-uni
vi-voy

  

Start of topic | Skip to actions

Requirements:

  • Python 2.4 or above (for the parser)
  • OCaml 3.09 or above: Compile the OCaml compiler with the 'make opt.opt' command to generate native-code versions of all the compilation tools (Read OCaml compilation instructions for details)
  • OCaml ExtLib library
  • OCaml findlib package manager

Usage instructions:

1) Compiling the translator and the runtime environment

  • Edit the relevant part of the toplevel Makefile to set paths. Then type 'make' followed by 'make install'
  • This should result in the creation and installation of 3 different things:
    • py2ocaml: The translator from Python to OCaml
    • pyenv.cma, pyyenv.cmxa: bytecode and native OCaml library for the runtime environment
    • libmontyffi.a: C library containing the OCaml/Python Foreign function interface

2) Compiling a Python program to OCaml bytecode/native code

Let your valid Python program be called 'foo.py'. There are 2 steps to translation to an OCaml executable

  • py2ocaml foo: This step produces an OCaml file called foo.ml
  • In order to compile foo.ml to an executable use the following (make a shell alias)
    • For native code: ocamlopt.opt -inline 100 -thread str.cmxa nums.cmxa unix.cmxa threads.cmxa extLib.cmxa pyenv.cmxa -o foo foo.ml
    • For byte-code (useful for debugging): ocamlc.opt -thread str.cma nums.cma unix.cma threads.cma extLib.cma pyenv.cma -o foo foo.ml

-- Main.RajB - 15 Dec 2007


End of topic
Skip to actions | Back to top
Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.