Software
This course will make use of the following software:
Operating system: an x86-64 ABI conforming OS such as many variants of Linux and macOS running on an x86-64 CPU. It is also possible to use macOS on an Apple Silicon CPU with some extra steps. For Using Windows, see notes below.
All students have access to the campus GRACE cluster, which use Red Hat Linux on an x86-64 CPU, an appropriate OS for this class. See the Using GRACE notes below.
Racket: the implementation language and source language of our compilers.
Racket langs package: a package containing utilities for this course.
NASM: the Netwide Assembler, which we will use to assemble x86 programs.
GCC: the GNU compiler collection or a GCC-compatible system such as clang.
Instruction for using each system are below:
1 Using GRACE
The GRACE system gives students access to an x86-64 Linux system that meets all of the system requirements for the software in this course. If you have an incompatible system, or if you’d rather avoid installing and setting up the software for this course, you can use GRACE.
Before using GRACE, you should locally install an implementation of the X.Org X Window System which will enable you to run GUI programs from GRACE on your computer (or any other computer that uses X11). On Linux, this is likely set up by default. On Mac, you will need to install XQuartz. On Windows, you can use MobaXterm.
To use GRACE, open a terminal on your computer and type:
ssh -Y <directoryID>@grace.umd.edu |
You will prompted for your UMD Directory ID password. After entering your password, you will be at the GRACE command line prompt.
The -Y command line option sets up X11 forwarding, which lets you run GUI applications from GRACE. If you leave this off, programs like DrRacket will fail to launch when started.
Racket and nasm are already installed, but you will need to modify your PATH environment variable so that you can execute them from the command-line. You can do this with the following commands:
# CMSC 430 set up |
set path = ( /cell_root/software/racket/8.4/sys/bin $path ) |
set path = ( /cell_root/software/nasm/2.15.05/sys/bin/ $path ) |
If you add these lines to the .path file in your home directory, then you won’t have to run this command manually every time you login; it will happen automatically.
Once set, you should be able to run commands such as racket, raco, and nasm. Other tools such as gcc are already available.
Finally, you will need to install The langs package.
2 Using Linux
If you have an ARM-based machine, you will need to use GRACE or potentially setup an x86 VM.
For x86-based Linux machines, you will need to install Racket and the langs package. Finally, install nasm. You can use your favorite package manager; they should all have nasm.
3 Using macOS
If you are using a macOS computer, the setup will be different depending on whether you have an Intel-based CPU or an Apple Silicon CPU. If you’re unsure which you have, click the Apple icon in the top-left and select "About This Mac". Under CPU, you will see a chip name containing either Intel or Apple.
3.1 Using macOS on Intel
Intel-based Macs are fairly straightforward to set up. You will need to install Racket and the langs package. You will also need to install nasm. It’s probably easiest to use a package manager such as Homebrew to install with brew install nasm.
You will also want to make sure your Racket installation is visible from your PATH environment variable. Assuming Racket was installed in the usual location, you can run:
PATH=$PATH:"/Applications/Racket v8.6/bin" |
You can add this line to the .zprofile file in your home directory so that it is available every time you start the Terminal.
3.2 Using macOS on Apple Silicon
It’s also possible to run everything we need on an Apple Silicon Mac even though it doesn’t use an x86 CPU and instead uses an ARM processor. That’s because Apple provides a compability layer called Rosetta that will allow you run x86 programs on your ARM CPU.
The set up is basically the same as when Using macOS on Intel, except that when you install Racket you need to select the installer for Mac OS (Intel 64-bit) when downloading Racket. Do not use Apple Silicon 64-bit installer. This will work thanks to Rosetta.
Otherwise, follow the steps given above.
4 Using Windows
For Windows users, using WSL for testing is highly recommended. Beyond the first few assignments, the projects will require generating and executing assembly code using the nasm package. Students in the past have had trouble trying to configure this in the Windows environment, so an easier workaround is simply to enable WSL and run your tests through some Linux Distribution. Here is a breakdown of the steps:
Following the instructions at this link, install a Linux Distro of your choice (e.g., Ubuntu). The instructions include a suggestion to upgrade to WSL2; this is not necessary but will improve efficiency in general.
Open your installed Linux distribution of choice and make any initial configurations necessary (user, pass, etc.). Run sudo apt update and follow with sudo apt upgrade. These two may take some time.
Run sudo apt install racket and sudo apt install nasm. These two should cover the necessary installations for this course.
Here is where to determine which IDE you would like to use.
Using vim (or Emacs as mentioned in the previous section) is simple. Copy assignment files into WSL. Modify files.
Previous students preferred installing VSCode (outside of WSL) from this link. For each assignment, copy assignment files somewhere on your Linux distro. For some .rkt file, call ’code some-rkt-file.rkt’ and after some automatic set up, VSCode should load up the file. Install Racket extensions from the VSCode Marketplace (a suggestion will also pop up once you open a .rkt file) to have colorized syntax, bracket matching, inteliSense, etc.
If you are intent on using DrRacket, you would also need to install Racket on your local machine (outside WSL). For each assignment, copy assignment files into your normal file system and use DrRacket to edit files accordingly. To access from your Linux subsystem, create a soft symbolic link in your Linux distro to the project directory (or the parent directory so you do not need to make links with each new project).
Regardless of the IDE used, you can now run your tests from your Linux subsystem by entering the project directory and using the raco command.
5 Installing Racket
Racket is available for all major operating systems from:
We will be using Racket 8.7, but any version from the past several years should work fine.
There are two essential references:
The Racket Guide - intended for those new to Racket, i.e. you!
The Racket Reference - the definitive, comprehensive manual for Racket
Racket is a large, full-featured, batteries-included language platform. However, we will be using only a small subset of Racket. This subset should be easy to pick up for anyone familiar with functional programming. If you’re comfortable with basic OCaml, Haskell, or even JavaScript, you shouldn’t have much trouble learning the Racket bits we will be using.
6 The langs package
After installing Racket, install the langs package which includes course utilities such as the a86: a Little Assembly Language library.
To install, run the following command:
raco pkg install 'https://github.com/cmsc430/www.git?path=langs#main' |
To test the package works as expected, run:
raco test -p langs |
All of the tests should pass; if they don’t, consult course staff.
The package source is hosted on Github. To check for and install updates, run:
raco pkg update langs |
7 IDE
Racket comes with it’s own IDE: DrRacket, which is the recommended way to edit Racket files. We will also be running Racket and its associated tools from the command line.
If you’d like to use Emacs, there’s a good Racket mode, but we recommend using DrRacket for a while before switching to Emacs. Using any other editor is fine, too.