A Quick Introduction to Using Camelot

We assume that you want to compile the program testList1.hswhich is included in the examples directory of the Camelot directory (available from our web Server).

Installing

You can download the Camelot compiler from the Camelot Web Page.

If you download a binary RPM, just issue the command rpm -ivhrpm-file. If you download a source bundle, unpack it with

   tar xvfz tgz-file 
Go into the directory Camelot-distrib/src and type make.
   cd Camelot-distrib/src 
   make  
See Section the Section called Software Dependencies about software you need to build the compiler.

Create a link to the top-level compiler and put it into your path, e.g.

   ln -s camelot ~/bin 

To test the compiler, go into Camelot-distrib/examples and follow the instructions in the Section called Compiling.

Compiling

In the simplest case do something like (the compile-time options are explained in Compiler options).

   camelot testList1.cmlt 

This will generate a Java class file testList1.class, which contains the JVM bytecode for the Camelot program. A second class file with the name testList1$dia_0.class will be generated, too. This file contains the bytecode for the memory management of the Java program, which depends on the data types use in your program and therefore has to be generated with every user program. You don't have to know any details about this class file, just be sure that both of these files are in your classpath when you execute the program.

Executing

To run the generated program just call the java interpreter, preferably JDK 1.4.xx (see Software DependenciesYou should have the following software installed to compile and run Camelot programs:JDK 1.4.xx (to run the generated class file)If you want to build the Camelot compiler from source you additionally need the following software:Moscow ML (to build the Camelot compile from source)OCaml (to build LFD module, only; OCaml page)lp_solve (to build LFD module, only; download), from the commandline (see the docuemntation on that Java interpreter on how to pass run-time options to VM), e.g.

  java testList1 3 4 5 

and you should see the following as output from this example program:

Input list:
 xs = [3, 4, 5]
Cloned list:
 ys = [3, 4, 5]
In-place update of first element in xs with 0 (nuke1st xs):
 zs = [0, 4, 5]
Cloned list:
 ys = [3, 4, 5]
Substituting 99 for 0 in zs (subst1 99 0 zs):
 zs' = [99, 4, 5]
Cloned list still is:
 ys = [3, 4, 5]
What a great system!

Software Dependencies

You should have the following software installed to compile and run Camelot programs:

If you want to build the Camelot compiler from source you additionally need the following software: