COMP 211: Principles of Imperative Computation

Office Hours

Dan (Exley 633): Wednesday, 3pm-4pm, and by appointment.
Lizzie and Xiping: Sunday, Exley 74, 7pm-8:30pm
Kiley and Ted: Monday, Exley 74, 7pm-8:30pm
Kevin and Max: Tuesday, Exley 74, 7pm-8:30pm

Labs

Lab 1 (Lizzie, Max): Wednesday, 6pm-7:30pm, Exley 74
Lab 2-1 (Ted , Xiping): Wednesday, 7:30-9pm, Exley 72
Lab 2-2 (Kevin , Kiley): Wednesday, 7:30-9pm, Exley 74

Piazza

We will use Piazza for questions about the assignments, for students to discuss course materials, and to make announcements about the class. You are responsible for being current with the information and discussions that are posted there.

You will get an email from Piazza with a link inviting you to create an account within the first week of the term. If you haven't gotten one in that time, please contact course staff.

In addition to the web interface, there are Piazza apps for Android and iOS available for free through their respective app stores.

C0

You can find documentation on C0 here.

Mac OS:

  1. First you will need the Xcode command line tools:

    If you have Mavericks (10.9), you can install just the command line tools by opening Terminal (from Applications/Utilities) and running xcode-select --install and then following the instructions.

    If you have Mountain Lion (10.8), you can download the Xcode command line tools by getting this package.

    If you have Lion (10.7), you can download the Xcode command line tools by getting this package.

    If you have Snow Leopard (10.6), ask the course staff how to install Xcode for Snow Leopard with the command line tools.

  2. Now that you have installed those, we will next pick a place to install the C0 programming language. Unless you have reason to do otherwise, we will use the location /Users/YOURNAME/software/c0/ where YOURNAME is replaced by your OS X username in what follows. If you don't know what your username is, open Terminal (from Applications/Utilities) and type echo $USER.

    Open Terminal (from Applications/Utilities), and type each following commands on a line by themselves, pressing return after each one:

        cd /Users/YOURNAME/
        mkdir software
        cd software
        mkdir c0
        cd c0
    After each line, you should hit enter to execute the command. mkdir makes a folder, and cd changes the folder you're in to the one specified.
  3. Right-click the following link and click "Save Link as..." to save the file to the directory /Users/YOURNAME/software/c0:
  4. In Terminal, make sure you are in the directory /Users/YOURNAME/software/c0 (you can check this by running the command pwd) and then run the command tar -xkvzf cc0-* to extract the C0 implementation.
  5. To test the installation, in Terminal, run cc0/bin/coin. You should see
          C0 interpreter (coin) 0.3.2 'Nickel' (r349, Wed Aug 28 18:31:41 EDT 2013)
          Type `#help' for help or `#quit' to exit.
          -->
        
    Type #quit to exit.
  6. Next, you will add /Users/yourname/software/c0/cc0/bin to your PATH environment variable. This lets you run C0 without specifying the full location. To do this, run the command

          echo 'export PATH="/Users/YOURNAME/software/c0/cc0/bin:${PATH}"' >> ~/.bash_profile
        
  7. Close the terminal window that you are using and open a new one (use Terminal / New Window from the menu). This makes the PATH take effect. Now you should be able to simply run coin.

  8. You will also need two C libraries named libpng and zlib. First, install MacPorts from that link. Then, in Terminal, run sudo /opt/local/bin/port install libpng zlib to install these two libraries.

Linux

The general idea is the same as MacOS: Pick a place to install the software, download one of the following tar files to that directory, extract it, put the cc0/bin directory in your path, and make sure you have libpng and zlib installed. Please consult with the course staff if you need more specific help.

Linux 3.9.3 (32 bits), created under Ubuntu 12.04 (Precise Pangolin).

Linux 3.9.3 (64 bits), created under Ubuntu 12.04 (Precise Pangolin)

Windows

  1. Cygwin lets you do Unix-y things on Windows; it will come in handy in other CS classes. First, you need a standard Cygwin installation. Download the 32-bit Cygwin installer from http://cygwin.com/install.html (do not get the 64-bit variant). Run the installer using standard paths (should install to C:\cygwin). Eventually, it will ask you which packages to install. Search for the following packages, and for each one, click "Skip" once so a version number appears, like in the image ("Skip" means "do not install"; the version number means "install this version").

    a Cygwin installation screenshot
    • wget
    • tar (may already be selected)
    • gcc-core
    • libpng15
    • libpng-devel
    • openssh
    • xorg-server
    • xinit
    • xorg-docs
    • xterm
    • make
    • vim
    • emacs
  2. The Cygwin installer will create a shortcut on the desktop which opens a Cygwin shell. If it fails, you can create a shortcut to C:\cygwin\bin\mintty.exe and change the "Start in" field to %USERPROFILE%.

  3. To install C0, you need to choose a location to install the C0 package. In this example, we'll use a directory we'll create called software/c0/ from your home directory. Launch Cygwin and then type the following commands.

        $ mkdir software
        $ cd software
        $ mkdir c0
        $ cd c0
        
    After each command, hit enter to run it. mkdir creates a new directory; cd changes the directory you're currently in.
  4. Now download and unpack C0:

        $ wget http://c0.typesafety.net/dist/cc0-v0349-cygwin-bin.tgz
        $ tar -xkzvf cc0-v0349-cygwin-bin.tgz
        
  5. Update your PATH to make C0 available:

    echo 'export PATH=$PATH:/home/YOURNAME/software/c0/cc0/bin' >> ~/.bash_profile
  6. Close the Cygwin terminal and open it again from the shortcut on the desktop. This makes the PATH change take effect.
  7. Now in the Terminal run coin. You should see
          C0 interpreter (coin) 0.3.2 'Nickel' (r349, Wed Aug 28 18:31:41 EDT 2013)
          Type `#help' for help or `#quit' to exit.
          -->
        
    Type #quit to exit.

Text Editor

We recommend GNU emacs or Sublime Text for editing C0 source files.

Sublime Text

Sublime Text is available here; get version 2.

On Windows, go to the above web site and download the installer. C0 syntax highlighting seems to be included. If it isn't, follow the same instructions as under Mac below.

On Mac, you need to do the following:

  1. Go here and click the OS X link under the Download header. Note that Sublime Text requires OS X version 10.6 or later. (For reference, the most recent release of OS X, Mavericks, is version 10.9.) To check your version of OS X, click the Apple icon on your menu bar and go to About This Mac.
  2. Once the download is complete, navigate to your downloads and open the Sublime Text 2.0.2.dmg file. A pop-up containing your local Applications folder and a Sublime Text 2 file. Drag the Sublime Text 2 file into the Applications folder.
  3. Sublime Text 2 should be installed after the file has been copied to the Applications folder. 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 2.
    • Terminal: In terminal, enter “cd /Applications ; open Sublime\ Text\ 2.app/“.
    • Launchpad: Open Launchpad and search for Sublime Text 2.
    If you choose to make Sublime Text 2 your preferred text editor, consider adding Sublime Text 2 to your Dock for quick access.
  4. To add syntax highlighting for C0, we will add a third-party package
    1. First, install Package Control.
      1. Open Sublime Text and access the console via View > Show Console in the menu bar.
      2. Copy the following code into the console's bottom white bar, and then press enter.
                        import urllib2,os,hashlib; h =
                        '7183a2d3e96f11eeadd761d777e62404' +
                        'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package
                        Control.sublime-package'; ipp =
                        sublime.installed_packages_path(); os.makedirs( ipp ) if
                        not os.path.exists(ipp) else None;
                        urllib2.install_opener( urllib2.build_opener(
                        urllib2.ProxyHandler()) ); by = urllib2.urlopen(
                        'http://sublime.wbond.net/' + pf.replace(' ',
                        '%20')).read(); dh = hashlib.sha256(by).hexdigest();
                        open( os.path.join( ipp, pf), 'wb' ).write(by) if dh ==
                        h else None; print('Error validating download (got %s
                        instead of %s), please try manual install' % (dh, h) if
                        dh != h else 'Please restart Sublime Text to finish
                        installation')
                      
        You should be prompted to restart Sublime Text.
      3. Restart Sublime Text.
    2. Second, install the SublimeC0 package.
      1. Press on Tools > Command Palette in the menu bar and search for “install package”, then press enter.
      2. Search for “C0” and press enter to install.
      To use C0 highlighting, you may now simply navigate to View > Syntax > C0.

Emacs

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

To install C0 syntax highlighting:

Some emacs resources:

LaTeX

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. LaTeX is installed on the Andrew UNIX servers, and can be downloaded and installed on local machines as well. 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, so 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:

Valid CSS! Valid XHTML 1.0 Strict