Using JoCaml

Using JoCaml (CSCI 6500)

JoCaml is installed in the directory /projects/wcl/bin/ You can login to a Linux machine by running:

   $ ssh linux.cs.rpi.edu

 

To use JoCaml, you have to set the path of the compiler in your environment, by executing the following command (assuming your environment is bash):

 

  linux00 ~ $ export PATH=$PATH:/projects/wcl/bin

Here is an example JoCaml interaction creating and using a reference cell:

linux00 $ jocaml
        JoCaml version 4.01.0
# def  mkcell(v0) = 
      def state(v) & get() = state(v) & reply v to get
       or state(v) & set(new_v) = state(new_v) & reply to set
       in       spawn state(v0);      reply (get,set) to mkcell
  in let gi,si = mkcell(0) in print_int(gi());si(7);print_int(gi());;
07- : unit = ()
# 

Now you may want to try compiling the example:

  

linux00 ~ $ cat > cell.ml def mkcell(v0) = def state(v) & get() = state(v) & reply v to get or state(v) & set(new_v) = state(new_v) & reply to set in spawn state(v0); reply (get,set) to mkcell in let gi,si = mkcell(0) in print_int(gi());si(7);print_int(gi());; linux00$ jocamlc -o cell cell.ml linux00$ cell 07

You can see the standard output shows "07".

For more examples and documentation, please take a look at the JoCaml tutorial.


Last modified: Fri Apr 15 11:11:03 EDT 2016