CIS-4050 Homework #5: Control Flow Graphs

Reading: TBD

In this assignment you will fill complete the implementation of the Control Flow Graph (CFG) builder in the Augusta code base.

Start by updating your clone of the Augusta project:

  1. Make sure you have committed all changes to your previous branches.
  2. Check out the ast-refactor branch using the command: git checkout ast-refactor. This should also switch you to that branch. Be sure you have the latest version using git pull. (if you just checked out the branch for the first time, it should already be the latest version.)
  3. Create a new branch for this assignment using: git switch -c homework-05. Since you are on the ast-refactor branch when you issue this command, your new branch will be based on ast-refactor.
  4. Clean up leftover artifacts to reduce possible conflicts: sbt clean. A more aggressive cleanup can be done using git clean -dfx. The latter command removes all files that are unknown to Git. It leaves your code base in the same state as if you had just done a fresh clone.

Part 1: Building the CFG

The goal of this assignment is to complete the method build in file CFG.scala. This entails finishing the implementations of the match cases for all of the statement forms in the AST (see AST.scala for a complete list).

You should also support the initializers in object declarations. Put each initializer into its own basic block. You will need to create an assignment statement AST node to hold the initializer and the variable being declared.

Finally, implement support for procedure declarations. This will allow a CFG for an entire procedure to be created.

Submit your CFG.scala file to Canvas


Last Revised: 2025-04-30
© Copyright 2025 by Peter Chapin <peter.chapin@vermontstate.edu>