COM 3355 Assignment #2. Assigned: Thursday, 16 January 2003 Due: Thursday, 30 January 2003, by 5pm EST Implement a static semantic analysis phase for quirk20 as specified below. This phase shall define a top-level procedure named checkTypes that takes one argument, an abstract syntax tree for a complete quirk20 program, and returns that very same abstract syntax tree after checking it for errors using the scope and type rules of quirk20, and after performing the side effects specified below. If checkTypes detects an error, it should call the top-level errMsg procedure with a string that describes the error, and should then call the top-level exit procedure with an argument of 1. (Neither of these procedures is part of R5RS Scheme. The errMsg will be provided by the instructor, and the exit procedure is provided by most implementations of Scheme. If your implementation does not define an exit procedure, please define your own for testing.) If the program contains no errors, then checkTypes returns its argument after performing the following side effects: If the operation of a UnOpExp or BinOpExp node is an overloaded operation, then checkTypes must resolve the overloading by calling Ast.updateOp on the node with an appropriate second argument. (This may transform the node into a different kind of node, so this should be the last action that checkTypes performs on the subtree rooted at that node.) For each NewRecordExp node, checkTypes must use Ast.update1 on the node to store the number of dynamic fields n within the record being created, and must use Ast.updateInits on the node to store an array of n integers that encode the type of each of the dynamic fields, using the encodings defined in qtype.Qtype, e.g. Qtype.iDoubleType. For each NewArrayExp node, checkTypes must use Ast.updateInits on the node to store an array of length 1 that encodes the initial value for each of the array's elements. For each FieldExp node, checkTypes must use Ast.update1 on the node to store the offset of the field that is referenced by the node. The instructor is providing Scheme code to parse a quirk20 program and to implement the Qtype abstract data type. See the documentation on the web page. The code will be in /course/com3355/Assignments/Assignment2 Please do not modify the instructor's code, as that would make it harder to combine your semantic analysis phase with a code generator written by someone else. If you find a bug in the instructor's code, please report it. Submit your code using the /course/com3355/submit-3355 script that is documented on the course web page.