|
Computer Science 510
|
|
If you have already installed the Coq Platform via opam, then you have already done the steps below up to Ocaml. If you have installed the Coq Platform via compiled binaries, you'll need to perform all these steps.
If you'd rather use Emacs or some other text editor instead of VS Code, see Text Editors note below. In this course you will be writing very little OCaml code (just this week's homework), so you may not need a fancy IDE.
If you'd rather not install OCaml at all, then you can use OCaml on the CS-department "cycles" machines. Just log into cycles.cs.princeton.edu, and /usr/bin/ocaml and /usr/bin/ocamlc should be in your searchpath.
Follow these instructions in Michael Clarkson's textbook, OCaml Programming: Correct + Efficient + Beautiful. Clarkson gives instructions for installing:
If you'd rather not use VS Code, just follow the instructions above up to step 3. Then you can use Emacs or some other text editor.
$ opam install tuareg
Once the install completes, there are instructions indicating the lines of code you should copy in to your .emacs file. Cut and paste those lines in to your .emacs file, adjusting the placeholder variables to be the correct path, as stated in the instructions given by OPAM.
You can also find the Tuareg software and installation instructions on the Tuareg github. The key files for manual installation are tuareg.el, tuareg_indent.el, ocaml_debug.el, and tuareg-site-file.el. Place these files in an accessible directory, and add the following line to your .emacs configuration file, substituting that directory for $DIR:
(add-to-list 'load-path "$DIR") (load "tuareg-site-file")
Once you have installed OCaml, Emacs, and Tuareg open any file with a .ml or .mli extension. This should start up Tuareg mode and you should see OCaml key-word, comment color highlighting and other features. To start the OCaml top-level interpreter in Emacs, on Windows at least, make sure the OCaml bin directory is in your path. At this point, you should be able to type C-c C-s in Emacs and the OCaml top-level interpreter will start. Alternatively, you can start OCaml from the Tuareg pull-down menu by choosing "Interactive Mode" and then "Run Caml Toplevel."