Help with SML/NJ


You may want to read Keunwoo's 29 March 2001 section notes if you have no clue about Unix, Emacs, and SML/NJ and want to get started quickly.


General SML/NJ information


Running SML/NJ on...

...instructional Linux machines (command prompt)

Note: Linux/Unix is the preferred platform for CSE 341, and we strongly recommend you use it.

Once you login to the instructional Linux machines using SSH or some form of X server, type sml at the command prompt. To exit out of SML/NJ, hit Control-d.

...Windows machines in the undergrad labs (command prompt)

SML/NJ is installed on all the machines, run it from the Start Menu --> Programs --> Standard ML of New Jersey. You can cut and paste into the interpreter by right-clicking to get a pop-up menu.


Emacs and SML/NJ on UW Unix/Linux machines

You can add an SML mode to Emacs, as follows. First, if you do not have a .emacs file, just create an empty file in your home directory and name it .emacs.

Next, place the following lines in your .emacs file:

; SML/NJ stuff
(add-to-list 'load-path "/cse/courses/cse341/common/sml-mode")
(load "sml-mode-startup")

; Global coloring
(global-font-lock-mode)

You should be good to go. There is only really one command that I ever use: typing C-c C-b in an sml-mode buffer (your edit window) will file in the contents of the current buffer. (Note: the first time you do this, it will start sml, but may not file in the contents of your buffer. Just go back and do it again. If everything works, you should see messages printed in the interaction buffer.) Note that this only works for UW CSE machines---for other Unix machines, you will need to do the following:

  1. Download SML mode and install it yourself in some directory.
  2. Use the above lines in your .emacs file, but change the first line to:
    (setq load-path (cons "YOUR PATH HERE" load-path))
    

SML-mode has plenty of other cool features as well; read about them in the SML mode official documentation.

Saving session transcripts

You can use M-x shell to run a shell child process; type 'sml' at the prompt. To save the resulting buffer in a file, switch to that buffer and type C-x C-s. You will be prompted for a filename, as if this were any other unnamed buffer.

For even greater convenience, you can type C-c C-l while in your sml-mode buffer. This will automatically bring up SML/NJ with your current file loaded in the buffer. Hitting C-c C-l again will reload the file.


Comments to
cse341-webmaster@cs.washington.edu
Last modified: Tue Jan 8 13:19:29 PST 2002