This assignment will require you to write in OCaml, a popular and efficient ML variant. ML variants are favored by PL researchers because they are particularly good for writing programs that manipulate other programs. Manual: http://caml.inria.fr/pub/docs/manual-ocaml/index.html Tutorials: http://caml.inria.fr/pub/docs/manual-ocaml/manual003.html http://www.ocaml-tutorial.org/ Book: http://caml.inria.fr/pub/docs/oreilly-book/ Download It: http://caml.inria.fr/ocaml/release.en.html ---------------- In this assignment, we will be manipulating (interpreting) IMP programs. All the work in lexing and parsing has been done for you. You need only flesh out the semantics-based interpreter. README.txt this file imp.ml Abstract syntax of Winskel's IMP as an abstract data type (AST) lex.mll A "lex" file for our IMP concrete syntax parse.mly A "yacc" file for our IMP concrete syntax main.ml A main() driver that reads an IMP command from stdin and evaluates it hw1.ml The file you must edit so that it contains an interpreter for IMP hw1.mli Your hw1.ml must meet this contract (although it can do other things) hello.ml "Hello, World" in OCaml Makefile "make hello", "make all", "make clean" and "make test" ---------------- Get ocaml up and running on your system. Make sure that "make hello" works. Part of comparing and evaluating languages involves being able to run and try out new languages and run-time systems. ---------------- Run "make all" to build the skeletal IMP interpreter. Run the resulting imp executable and type in "skip ." as input. You should see something like this: $ ./imp Enter an IMP command (use . to end your command): skip . skip The harness accepts an IMP command (terminated with a "."), pretty-prints it back out, and then interprets it. Interpreting skip is not very exciting, however. Our concrete IMP syntax is more or less what you would expect. It also supports ()'s, {}'s, and comments. Example concrete IMP command: x := 5 ; /* comment */ { if x <= 9 then { x := x - (5 - 3) } else print x } ; x := 6 . ---------------- Inspect imp.ml to get a feel for how we have translated IMP into ML. The translation is quite direct. Inspect hw1.ml to see the skeletal interpreter. The complete interpreter for the Aexp sub-language has been provided. You must complete the skeletal interpreters for Bexp and Com. Use the big-step operational semantics rules as guides. Keep at it until you pass all of the tests in "make test". ---------------- Write some tests of your own. Put your best test case in the file "example.imp".