COMP 321: Principles of Programming Languages

Help Sessions

Tuesday, 7:30pm-9pm, Exley 113
Wednesday, 7:30pm-9pm, Exley 113
Thursday, 7:30pm-9pm, Exley 113

All times are US Eastern.


We will use Microsoft Teams for announcements and questions about the course material / clarification questions about the assignments (questions that don't require divulging any partial solutions to problems). You are responsible for being current with the information and discussions that are posted there.


To install a local copy of sml/nj:

Mac OS

These directions worked on Mac OS Catalina/Big Sur.
  1. Start the Terminal application by selecting it from your Applications folder or by typing Terminal into Spotlight.
  2. In the terminal, run
              xcode-select --install 
    Run the installer that pops up if one does; otherwise you already have the command line tools installed.
  3. Install the Homebrew package manager according to the directions on that page. I.e. copy the script into the Terminal and run it.
  4. In the terminal, run
    brew install rlwrap
  5. In the terminal, run
    brew install smlnj
  6. In the terminal, run
    echo 'export PATH="/opt/local/bin:/usr/local/smlnj/bin:${PATH}"' >> ~/.bash_profile
  7. In the terminal, run
    echo 'alias smlnj="rlwrap sml"' >> ~/.bash_profile
  8. If you are on the latest MacOS (Catalina, Big Sur) and don't have strong preferences about what unix shell you use, run
    	chsh -s /bin/bash
    (then type your mac password and hit enter when prompted) to switch your default shell to BASH from the new default of zsh. If you do have strong preferences about using zsh, then add the equivalent of the above lines setting your PATH and smlnj alias to your zsh startup files.
  9. Close and restart the terminal and you should be able to run smlnj to start SML.
Work arounds:


These directions were tested on Windows 10. If you have an earlier version and this doesn't work, here are some old directions that might work.
  1. Use this installer.
  2. Install the VSCode editor and run SML in its terminal according to the directions below.

Text Editor

On a Mac, we recommend Atom or VSCode or Sublime Text or GNU emacs for editing SML source files. Atom and VSCode allow you to run a terminal inside of the editor, so you can run smlnj in there. emacs has a special mode for running SML code, but is less new-user-friendly. For Sublime, you can only run SML code from the separate Terminal application. On Windows, we recommend VSCode.


  1. Install VSCode and start it.
  2. On the left-hand side, you should see an icon that looks like three squares with one square sticking out. This is the place to install extensions. Install the following two extensions:
    • vscode-better-sml
    • Tomorrow and Tomorrow Night Theme from Microsoft. Click on this extension, and use the Set Color Theme button at the top to select one of the themes if it doesn't already prompt you to do so.
    This should make colorful syntax highlighting work for SML code.
  3. Create a folder for your COMP 212 work and select it via Open Folder... (Windows) or Add folder to Workspace... (Mac). You should put the .sml files you download from the course web site into this folder.
  4. You can start a terminal in VSCode by using the Terminal / New Terminal menu option.
  5. Type smlnj (Mac) or sml (Windows) to start SML.


  1. Install Atom.
  2. Install the language-sml package by going to Prefrences/Settings, choosing the Install tab, and then typing it in to the search box at the top.
  3. You can run smlnj in the built-in Mac Terminal application, but you want a terminal in Atom, you can install the platformio-ide-terminal package. Then, you can start a terminal by going to Packages / platformio-ide-terminal / New Terminal...

Sublime Text

Sublime Text is available here; get version 3.

More specifically:
  1. Download the installer for your operating system. On Windows, follow the instructions in the installer. On Mac, navigate to your downloads and open the .dmg file. A pop-up containing your local Applications folder and a Sublime Text 3 file. Drag the Sublime Text file into the Applications folder.
  2. On Windows, you can open Sublime Text through the Start Menu. On Mac, you can open Sublime Text in one of three ways:
    • Finder: Open a new Finder window, navigate to your Applications folder (it should be listed in the left-hand column) and double-click on Sublime Text.
    • Terminal: In terminal, enter “cd /Applications ; open Sublime\“.
    • Launchpad: Open Launchpad and search for Sublime Text.
    You may want to put a shortcut to Sublime Text on your desktop/in your Dock.
  3. Install Package Control: Go to the Tools menu, click on Command Pallet, and then type Install Package Control.
  4. To get syntax highlighting, install the "SML (Standard ML)" package:
    1. Press on Tools > Command Palette in the menu bar and search for “install package”, then press enter with Package Control: Install Package.
    2. Search for “SML (Standard ML)” and press enter to install.
  5. To use SML highlighting, you may now navigate to View > Syntax > SML.


If you have Linux, you almost certainly have emacs installed. For Mac and Windows get:

To install SML syntax highlighting:

  1. Make a software directory in your home directory (to do this in the terminal, run mkdir ~/software/).
  2. Download sml-mode.tar and unzip it in your software directory (to find it outside the terminal, your software directory will be in software in your home directory on a Mac or in C:\cygwin\users\YOURNAME\software on Windows). This will create a directory ~/software/sml-mode-3.3-custom.
  3. Open Emacs, type Control-x Control-f to open a file, and then edit the line at the bottom of the screen to
            Find file: ~/.emacs
    and press enter. This is your emacs startup file.
  4. Copy the the contents of dotemacs-win.txt (Windows) or dotemacs-mac.txt (Mac) into this file. On Windows, you will need to edit the first line, replacing YOURNAME with your Cygwin user name. NOTE: The windows file is untested; let me know if you have problems.
  5. Save, close, and restart emacs.
  6. When you open emacs again and open a file.sml, it will now color the syntax. Also, you can run SML inside emacs as follows:
    • Control-c Control-b: load the current emacs buffer into the SML repl.
    • Control-c Control-s: pop up a separate window with the SML repl.

Some emacs resources:


For the written assignments, you may wish to use LaTeX.

LaTeX is built from Don Knuth's TeX typesetting language, and has grown through community support to be both extremely powerful and easy to use. There are any number of excellent resources about how to use LaTeX; a few are listed here for your convenience.

LaTeX source files can be created with any text editor, and emacs and vim are excellent choices. There are several LaTeX specific IDEs that you may find more comfortable to use, depending on your working environment: