Ocaml may be downloaded from the INRIA official Ocaml web page (follow Download tab). Implementation exist running on Linux, Mac OS X and Windows.
Documentation relative to Ocaml is available through the offical Ocaml documentation web page.
Run ocaml from the shell prompt, then read the program text with a #use “filename.ml” command. All the definitions in the file will be interpreted as if they were entered directly at the current ocaml interpreter prompt.
Compile the program using the bytecode compiler ocamlc. Then run the resulting a.out either using ocamlrun command from the shell prompt or directly invoking the ./a.out
backus:SKammello marcod$ ls prova.ml skeletons.ml backus:SKammello marcod$ ocaml Objective Caml version 3.11.1 # #use "prova.ml";; val add : int -> int -> int = <fun> Il valore della somma e' 5 - : unit = () # #quit;; backus:SKammello marcod$ ocamlc prova.ml backus:SKammello marcod$ ls -t a.out prova.cmo skeletons.ml prova.cmi prova.ml backus:SKammello marcod$ head -1 a.out #!/usr/local/bin/ocamlrun backus:SKammello marcod$ ./a.out Il valore della somma e' 5 backus:SKammello marcod$ ocamlrun a.out Il valore della somma e' 5 backus:SKammello marcod$ cat prova.ml let add x y = x + y;; Printf.printf "Il valore della somma e' %d\n" (add 2 3);; backus:SKammello marcod$
Here you'll find Ocaml code related to the SPM course.
# 0.0 +. 1.0 ;; - : float = 1. #