From lliao@ren.eecis.udel.edu Thu Oct 3 23:06:38 2002 Date: Thu, 3 Oct 2002 23:04:50 -0400 (EDT) From: Li Liao To: Natasha Duncan Subject: Re: several questions > 1. the homework assignment states: > - dup: pop the number before it and push two copies of that number back. > Does it mean pop number from the top of the stack and push > two copies of that number back? Yes. >or is it the number before the top of the stack? > I mean the nubmer before the operator. That number should be just on the top of the stack when it is time to apply the operator. > 2. - begin: saves the current environment (that is, all the current > bindings) - do we have to use insert function from the Dictionary > structure for this? See answer for the next question. > but for - end:( restores the previously saved environment, discarding > all the definitions that have been made in the meantime) > we don't seem to have the right function (like pop or delete > from the Dictionary)What function do we have to use here? "begin" starts a scope and "end" closes a scope. All bindings within a scope are saved into an environment, which is implemented as Value Dict. As a program can have multiple scopes, each scope has its corresponding environment, and all environments are managed as a list. That is the type DictStack which is defined as Value Dict list. I believe we all by now know how to delete the first element from a list. > 3. In our lecture notes we didn't define > seval (var x) env > for some reason. Why? If we still have to define it, > how will it be implemented? The code in lecture note 8 is not complete. Please refer to the bboard message 12 for the complete version. > > 4. What does Exec of String do in datatype Command. > I couldn't find the description in the lecture notes? > This is explained in the homework 2, and the actual code of exec is given there for the simplest cases. Li