This assignment covers the structural checks that need to be performed on whole method and constructor bodies. It encompasses the two phases Reachability and DefiniteAssignment. You must hand in two files reachability.ml and definiteassignment.ml that extend the skeleton.

Reachability

The Reachability phase analyzes the code to ensure that no statements are unreachable and that methods and constructors always execute a return (Joos 2: or throw) statement, i.e. that they never run off the end of the body.

The analysis is described in Section 14.20 of the JLS and on slides 13-15 in the lecture on static analysis.

Transformations

Checks

DefiniteAssignment

The DefiniteAssignment phase analyzes the code to ensure that all variables are initialized before they are used.

The analysis is described in Chapter 16 of the JLS and on slides 22-28 in the lecture on static analysis.

The extra restrictions on local variable initializers imposed on Joos 1 eliminates the need for the definite assignment analysis. Only a Joos 2 compiler needs to perform the analysis.

Checks (Joos 1)

Checks (Joos 2)

Documentation

You must post an entry in your group blog that explains how your code works and which problems you have encountered and solved in the process. Furthermore: