Homework #14


This problem requires lecture 11 and book section 2.2.2.

Exercise 2.8, p.52 - (60 minutes)

Rewrite the solution to exercise 1.19 using abstract syntax. Then compare this version to the original solution.

See HW11 for exercise 1.19.

Use the same logic you used for 1.19, but make sure to work from the parsed abstract syntax instead of directly from the concrete syntax.

You won't have to modify the definition of parse-expression for this problem. You may not use the occurs-free? function defined in the book, but you may model your code after it if you wish. Be sure to use a cases construct for both free-vars and bound-vars.

Use may use the following code to begin free-vars:

(define free-vars
  (lambda (exp)
    (free-vars-aux (parse-expression exp) '())))

(define free-vars-aux
  (lambda (ast bound)
    (cases expression ast
           ...
    )))

Do something similar for bound-vars.

YOU MUST NAME YOUR FUNCTIONS:  free-vars, bound-vars.
You must log in first before submitting homework assignments.

Instructions on submitting homework is here


Last updated at 4:52 pm on Thursday, January 22, 2004.