Assigment 1: Closure conversion

Implement closure conversion for FbSR: write an OCaml function clconv which takes FbSR programs that may have non-local variables and produce a FbSR program without non-local variables that nonetheless interprets to the same value (for integer and boolean values that is). Along with the lecture, closure conversion is in Ch 8 of the PL book and in the Leroy notes.

Use the PLI FbDK for this assignment: here. We will be using OCaml 4.08.1, if you are using opam from PLI you will need to opam update, opam switch create 4.08.1, and opam install ... (list all the packages you had in 4.07, at least ocamlbuild merlin ocp-indent user-setup tuareg menhir) to get the latest version. The PLII coding page gives general information on the OCaml we will be using in this class; if you did not take PLI follow the link there to the PLI OCaml info page in order to install etc.

For this assignment just place your clconv function in the file src/FbSR/fbsrinterp.ml. You can either use the debugscript file to test it or define it to also be eval and turn the top loop into a closure convertor.

Use Gradescope to submit, I will post the course code on Piazza. We are not going to provide any test harness and you should write your own tests.