COS 320: Compiling Techniques - Spring 2022¶
Getting Started¶
To complete the assignments you will need an installation of OCaml and LLVM. Instructions for installing OCaml are available here.
Caution
The compiler we build targets the x86 64-bit processor architecture, which is commonly available on Intel and AMD based computers. If you have a new Apple M1 laptop, please contact the course staff for help.
Updating OCaml¶
Note
If you already have some version of opam installed in your system, but
your OCaml version is older than 4.13.1
(you can check it by executing
ocamlc --version
), please, update your set up and install the necessary
packages as follows:
opam update; opam upgrade
opam switch create 4.13.1
eval $(opam env)
opam install -y dune utop num menhir ocamlformat ocamlformat-rpc ocaml-lsp-server
opam user-setup install
Alternatively, if you don’t have a working opam
and OCaml, please,
follow the instructions below.
Installing LLVM and Clang¶
For some projectsin this class, we will be using the LLVM framework, which you can install as follows:
Ubuntu or MS Windows 10 with WSL: run
sudo apt-get update && apt-get install clang
macOS option 1: Install command line tools manually by running
xcode-select --install
from the terminalmacOS option 2: Install XCode (via the AppStore) run it, go to
Preferences
and install the command line tools on the “Locations” panel.macOS option 3: Intstall via Homebrew, run
brew install llvm
.
Project Management¶
The course projects are challenging and time consuming. They may require significant effort to understand the implementation details and concepts: Start Early!
GitHub Classroom¶
Most of the projects in this course will come with extensive (partially complete) skeleton code, test cases, infrastructure, etc. We will distribute that code using Github Classroom. You are encouraged to use git’s version control and code merge features to work with your partner collaboratively.
Accessing the project code
Each project has a corresponding github classroom repository. When you click on the link associated with the repo, you will be asked to associate your GitHub username with the identifier used by the Github Classroom roster. Your Github Classroom roster ID is your NetID.
Cloning the repository
Once you have connected to the Github classroom assignment, you should clone
the
repository. On the repository page, look for the green “Code” button, copy the repository
URL and then, from a terminal do:
git clone <<URL>>
For team projects, you can coordinate your code changes using git
. The most
important git
commands you will need for this course are: git pull
,
git add
, git commit
, and git push
. See the git
documentation for
more information about how to use them.
Submit your files Gradescope¶
Course projects will be submitted via Gradescope.
Each project will be accompanied by a Makefile
that will build a (time stamped) zip file suitable for submission to gradescope. For example, in HW1, you would do:
> make zip
zip 'hw1-submit-(<TIMESTAMP>).zip' bin/simulator.ml test/studenttests.ml
adding: bin/simulator.ml (deflated 69%)
adding: test/studenttests.ml (deflated 39%)
The result is a file called hw1-submit(<TIMESTAMP>).zip, which you should upload to Gradescope.
Copyright¶
Most of the materials and assignments for this module have been adapted, with permission, from the U.Penn’s CIS341 by Steve Zdancewic.