Assignment 22
Due Date Mon 4/10 at 11:59pm
Possible Points 28
Purpose To use design skills to extend a large program.
Graded Exercises
In this problem set, we will be extending the Husky language. This is similar to the language you saw in lecture but not exactly the same, so be sure to look it over. As you go, do not forget to update the definition of Ident as appropriate.
Exercise 1 As posted, the Husky language does not have full test coverage. Add tests as needed until it does.
Exercise 2 Extend Husky with Strings. This will involve changing the definitions of HExp and HValue, and adding a new cond branch to eval. And, of course, tests.
Exercise 3 Extend Husky with the and and or boolean operators. Note that these cannot be primitive functions. Rather, they are new control operators (like if): since they use short-circuit evaluation, they do not necessarily evaluate all of their parts.
Here are the semantics for these two forms, in English:
(and exp1 exp2 ...) evaluates the exp expressions from left to right. As soon as some expression produces false, evaluation of the and form stops and the whole expression produces false. If all the exp expressions produce true, then the entire and produces true.
(or exp1 exp2 ...) evaluates the exp expressions from left to right. As soon as some expression produces true, evaluation of the or form stops and the whole expression produces true. If all the exp expressions produce false, then the entire or produces false.
The following check-expects should pass:
(check-expect (eval '(or #f #t GARBAGE) empty) true) (check-expect (eval '(and #t #f GARBAGE) empty) false)