Laboratory exercises (Programming Languages)

Copyright © 2024 J. M. Spivey
Jump to navigation Jump to search

Solutions for tutors and demonstrators are on a separate page.

There are three laboratory exercises for the course:

  1. An exercise asking you to write a functional program for flattening nested lists, transform it into iterative form using an explicit stack, and then rewrite it using assignable variables and a loop. All this will be done in the Fun language that we will be studying in the course.
  2. An exercise where you will write a monadic interpreter for a language that combines call-by-name with assignable variables. This combination leads to a language with some strange features that are interesting to exploit.
  3. An exercise in exploring the semantics of a loop-with-exit construct that extends one present in Oberon.

I suggest that you attempt all three exercises, omitting the first one if it does not seem helpful.


Instructions for the labs are contained in a laboratory manual.

The supporting materials are accessible in a Mercurial repository that can be cloned with the command

hg clone

For safety's sake, I've also provided the materials here, packed into a single archive.