; Problem Set 9 (include-book "irun") (in-package "M5") ; Problem 9-1. ; The following constant (which contains a blank to be filled in) defines a ; class named "Cons" with two fields, "car" and "cdr", and one method, named ; "main" which takes no arguments. Fill in the :code component of the "main" ; method so that executing the main method constructs a linked list ; representing the (1 2 3 . -1). That is, the topmost Object is a "Cons" with 1 ; in the "car" and a reference to an Object representing (2 3 . -1) in the ; "cdr". The last "Cons" contains a -1 in the "cdr". You may not store any ; locals. At the conclusion of your program, the stack should contain exactly ; one item, a reference to the "Cons" in question. (defconst *ps9-ct* (make-ct (list (make class :name "Cons" :supers '("Object") :fields '("car" "cdr") :methods (list (make method :name "main" :formals nil :sync nil :code ... )))))) ; The following is a call of irun that should allow you to step through your ; program starting at the 0th instruction in it. (irun (make state :tt (list (make thread :id 0 :cs (push (make frame :pc 0 :locs nil :stk nil :mloc '("Cons" "main" 0)) nil) :stat 'active :ref nil)) :hp nil :ct *ps9-ct*))