HW 2: Abstract interpretation for divide-by-zero errors

When you submit your completed assignment, please indicate how long it took to complete. This will not factor into your grade. For anything that you submit in this class, place your name and UW ID on the top of the first page.

High-level goal

Divide-by-zero errors often catch developers off guard, with numerous documented issues. These errors can happen due to division by zero (e.g., 1/0) or mod by zero (e.g., 1%0).

The goal of this assignment is to design and implement a static analysis that prevents divide-by-zero errors.

Instructions

This homework has two parts – each with a dedicated submission deadline.

Part 1:

Give an abstract interpretation that catches possible divide-by-zero errors statically. You do not need to give transfer functions for every integer operation; addition, multiplication, and division will suffice.

Think carefully about your choices; the design space is quite large! You may assume that (1) we only care about integers (not floating-point values) and (2) overflow does not happen.

Briefly contrast your design to an alternative you chose. Name one way in which your design is better than the alternative, and one way in which it is worse.

Submit your design writeup to Canvas.

Part 2:

Implement your design (or a simplified version of it, as stated above) for integer division in Java:

  1. Clone the following repository: cf-homework.

  2. Familiarize yourself with the skeleton code and detailed instructions.

  3. Make local edits for development and testing, and commit your changes. (Atomic commits are valuable to document your attempts and thought process.)

  4. Tag the commit that passes the tests for grading as “hw2-final”. (You may explore additional ideas and make further commits, even if they break (additional) tests.)

  5. Submit an archive of your local repository to Canvas.