Homework #1

Due: Wed, Sep 30

How to Submit

  • Submit a single file named HW1.<your-username>.hs through Canvas. For example, my submission would be named HW1.walkiner.hs.

  • Read the Homework Policy! This describes what to do if you cannot solve a problem.


Template: HW1.template.hs

In this assignment, you will be defining the functions described in comments in the above template. You should download the template, rename it, and add your definitions directly to the file.

In addition to a brief English description of each function, the file contains doctest comments that illustrate the intended behavior of each function on a few examples. You can use these examples as unit tests using the doctest tool illustrated in class. Feel free to add more examples to improve your test coverage. Instructions for installing doctest are on the course web page.

In the assignment, you’ll be working with an abstract syntax tree (AST) representation of arithmetic expressions. We’ll spend more time talking about ASTs later in the course.

Back to course home page