CS G262 Assignment #3. Assigned: Thursday, 16 September 2004 Due: Thursday, 30 September 2004, by 6pm Implement a static semantic analysis phase for quirk21 as specified below. This phase shall define a top-level procedure named checkTypes that takes two arguments, an abstract syntax tree for a complete quirk21 program and an initial type environment, and returns an attributed abstract syntax tree after checking the original tree for errors using the scope and type rules of quirk21. 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 an abstract syntax tree that is just like the original except: If the operation of a UnOpExp or BinOpExp node is an overloaded operation, then the transformed abstract syntax tree shall contain a type-specific version of that operation in place of the overloaded operation. If a BinOpExp node calls for mixed-mode arithmetic on arguments of type INT/FLOAT or FLOAT/INT, the transformed abstract syntax shall contain an additional UnOpExp node, with the coerce_int_to_float operation, inserted between the abstract syntax tree of type INT and the BinOpExp node. For each FieldExp node, checkTypes must use astUpdate1 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 quirk21 program. The code is in /course/csg262/Assignments/Assignment3 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, and work around it as best you can until the instructor fixes it. Instructions for submitting your code will be provided later.