From leavens@larch.cs.iastate.edu Wed Sep 6 16:15:30 2006 Date: Wed, 6 Sep 2006 16:15:30 -0500 (CDT) From: Gary T. Leavens To: Kent Vander Velden Subject: Re: HW2 Hi Kent, On Wed, 6 Sep 2006, Kent Vander Velden wrote: > I am looking at problems 4 and 5 from the CS541 HW2 and have some > questions. When you write 'the extended language' are you writting about > the syntax described in chapters 2.6 (From kernel language to practical > language) and 2.7 (Exceptions)? Yes, mostly about section 2.6. I think some of the syntax in 2.7 is considered kernel syntax and some extensions. > Actually, would you be willing to provide a > couple examples of what you expect input and the associated output to look > like? That might help the most to make the problems clear. Sure, I'll work on that. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ----------------------- From leavens@larch.cs.iastate.edu Sun Sep 10 13:59:23 2006 Date: Sun, 10 Sep 2006 13:59:23 -0500 (CDT) From: Gary T. Leavens To: Chris Cornelison Subject: Re: cs541 - HW2 Hi Chris, On Sun, 10 Sep 2006, Chris Cornelison wrote: > In Problem 12, Exceptions > > In looking at the book's translation of the finally clause into kernel > syntax... > > try 1 finally 2 end > > to... > > try 1 > catch X then > 2 > raise X end > end > 2 > > (where an identifier X is chosen that is not free in 2. > > I don't understand the reason for the "raise X end" inside the catch. Because if an exception is caught, then we want to continue with that exception after raising it. > Also, I'm not sure what they mean by X is chosen not free in 2. It means that X can't shadow a variable declared outside of 2 in a way that would interfere with the meaning of 2. Technically if FV(S) gets the set of free varialbes in S, then we just have to choose X such that X is not in FV(2). Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------- From leavens@larch.cs.iastate.edu Tue Sep 12 18:03:51 2006 Date: Tue, 12 Sep 2006 18:03:51 -0500 (CDT) From: Gary T. Leavens To: Computer Science 541 Subject: New version of Assert, AssertEqual, Test procedures for Oz Hi all, I made a version of my assertion file that is better testing, which you may be interested in. Feel free to use it. It's below. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 declare proc {Assert B Msg} if B then skip else raise 'Assertion Failed: ' # Msg end end end proc {AssertEqual Expected Actual} if Expected == Actual then skip else raise 'Expecting: ' # Expected # ' got: ' # Actual end end end proc {Test Actual Expected} local A=Actual E=Expected in if A == E then {System.showInfo {Value.toVirtualString A 5 10} # ' = ' # {Value.toVirtualString E 5 10} } else raise 'Expecting: ' # Expected # ' got: ' # Actual end end end end % ----------------------------------