COMP 211: Principles of Imperative Computation

Office Hours

Dan (Exley 633): Tuesday, 4pm to 5pm, Wednesday, 11am-noon, and by appointment.
Justin: Sunday, Exley 74, 7pm-8:30pm
Max: Monday, Exley 74, 7pm-8:30pm
Robby: Tuesday, Exley 74, 7pm-8:30pm

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.

Running C0 in Exley 74

  1. Use XythosFS to map the H: drive to WesFiles: To do this, double-click XythosFS on the desktop, and then click the little + sign and make a new connection as follows:
            Volume name: WesFiles
            Full URL: https://wesfiles.wesleyan.edu
            Username: Your username
            Password: Your password
          
    Then highlight this connection and click the connect button.
  2. Open Cygwin Terminal (from Start Menu / All Programs / NSM / Cygwin)
  3. Now you should be able to run coin:
           /cygdrive/h/courses/COMP-211-dlicata/cc0-win/coin
         
  4. You'll want to save your work in WesFiles (H:) so you can access it on other computers. You should go to https://wesfiles.wesleyan.edu and make a directory comp211 for your files, and then make sure the permissions are set so that only you can access them. Otherwise you will be in violation of the course collaboration policy.

Installing on your computer

Installing C0 is a bit tricky, so please come to office hours if you have trouble. If you're brave, you can try to follow these installation instructions:

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.

  2. Pick a place to install the software. Unless you have reason to do otherwise, pick /Users/YOURNAME/software/c0/ where YOURNAME is replaced by your OS X username. If you don't know what this is, open Terminal (from Applications/Utilities) and type echo $USER.

    Open Terminal (from Applications/Utilities), and type

        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 -xvzf cc0-* to extract the C0 implementation.
  5. To test the installation, 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, first run the command echo $SHELL.

    If the result is /bin/bash, run the command
          echo 'export PATH="/Users/YOURNAME/software/c0/cc0/bin:${PATH}"' >> ~/.bash_profile
        
    If $SHELL is something else, ask a TA for help.
  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 run sudo /opt/local/bin/port install libpng zlib to install these two libraries.
  9. See the instructions on installing emacs below.

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 -xzvf 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 type 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.
  8. See the instructions on installing emacs below.

GNU emacs

We recommend GNU emacs for editing C0 source files. However, C0 files are just text files, and you can edit them with any text editor (Notepad, Notepad++, TextEdit, Sublime Text). If you have Linux, you almost certainly have emacs installed. For Mac and Windows get:

To install C0 syntax highlighting:

Some emacs resources:

LaTeX

If we have 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