Skip to content

Paper! A Gentle Introduction to Multi Stage Programming

sarostru edited this page Jul 7, 2015 · 5 revisions

http://www.cs.rice.edu/~taha/publications/journal/dspg04a.pdf

This is a practical paper, and it will help to follow along in MetaOCaml. You will need to first install OCaml and its package manager, opam (see instructions below). You can then run metaocaml and the examples in the paper should work as shown.

$ metaocaml
BER MetaOCaml toplevel, version N 101
        OCaml version 4.01.0

# let a = 1+2;;
val a : int = 3
# let a = .<1+2>.;;
val a : int code = .<1 + 2>.

Installing MetaOCaml on Debian/Ubuntu

See OCaml installation instructions here and MetaOCaml installation instructions here or just:

apt-get install ocaml
opam switch 4.01.0+BER
opam init  # yes, you do want to update files
eval `opam config env`
opam switch 4.01.0+BER  # this will take 78.3 times the age of the universe
eval `opam config env`  # dann had to do this again after opam switch

Installing MetaOCaml on Mac with Homebrew

See OCaml installation instructions here and MetaOCaml installation instructions here or just:

brew install ocaml
brew install opam
opam init  # yes, you do want to update files
eval `opam config env`
opam switch 4.01.0+BER  # this will take 78.3 times the age of the universe
eval `opam config env`  # i had to do this again after opam switch

Installing MetaOCaml on gNewSense in a Faraday cage with a 60ft air gap and only a 5V battery in place of a keyboard

Haha, you're on your own.

Installing MetaOCaml on Windows

Gave up on this, but it seems doable just a bit arduous.

  • Use the ocaml installer to install cygwin and some binary builds of ocaml
  • Download the Ocaml Source
  • Download the BER MetaOCaml Patch
  • After installing cygwin and the binary build from the installer, you need to start following the instructions on the BER metaocaml page.
  • This is where I got to, some of the build tools don't get configured properly so to follow the steps you need to do some manual intervention.
  • First you need to symlink all the i686-w64-mingw32 executables to normal ones, e.g. i686-w64-mingw32-gcc.exe to gcc.exe.
  • Then there are still some build problems, I think you need to track down flexlink for windows and maybe adjust the configure script, it seems to have a problem regarding 8 byte integers.
Clone this wiki locally