Course Info

  Announcements

  Staff and Hours

  Syllabus

Course Work

  Class Logs

  Exercises

  Exams

  WebCT

Resources

  Readings

  OCaml

  Learning

  Research

The OCaml Compiler in Our Labs

Ocaml is available on all the department's instructional Linux workstations.

To bring up the latest version of the Ocaml interactive compiler just type ocaml at the prompt of an unix shell.

Once the interactive compiler is loaded you will be prompted for input. To run an Ocaml expression you can either type it directly at the Ocaml prompt (#) or copy and paste it from your editor of choice.

Expressions can be typed over multiple lines by pressing the Enter key. You can evaluate an expression by ending it with a double semicolon (;;) and then pressing the Enter key. This will cause the interactive compiler to compile the expression, evaluate it, and print the result (or error messages).

You can also load an Ocaml source file by typing
#use "file-name";;
at the Ocaml prompty where file-name is the file's name. This will cause the compile to read, compile and execute source phrases from the given file just as if they were typed on the standard input. The reading of the file stops at the first error encountered. Type
#quit;;
or Control-D to quit the compiler.


Last Updated: Sep 5, 2006