正在加载图片...
Since environments are, in general, complex circular list structures, we have set Scheme's printer so that it will not go into an infinite loop when asked to print a circular list. (See the descriptions of *unparser-list depth-limit* and *unparser-list-breadth-limit* in the Scheme reference manual.) You will notice that when you have run driver-loop, the mode line(bar at the bottom of edwin with the buffer name along with (Scheme: listen)) will display (scheme Meval: listen) instead. This indicates that meval ill be receiving anything you c-x C-e, instead of (regular) MiTSche In order to give you further warning when you accidentally send things to Meval instead of mitscheme. the *warn-meval-define* variable controls whether Meval will print out warnings if the define you're evaluating is binding a variable that is also bound in mitscheme Computer Exercise 1: Exploring Meval Load the code files into your Scheme environment. To begin using the scheme nterpreter defined by this file, evaluate (driver-loop). Notice how it now gives you a new prompt, in order to alert you to the fact that you are now talking"to this new interpreter. Try evaluating some simple expressions in this interpreter. Note that this interpreter has no debugging mechanism--that is, if you hit an error, you will be thrown into the debugger for the underlying Scheme. This can be valuable in helping you to debug your code for the new interpreter but you will need to restart the interpreter You may quickly notice that some of the primitive procedures about which Scheme normally knows are missing in m-eval. These include some simple arithmetic procedures(such as *)and procedures such as cadr,cddr, newline Extend your evaluator by adding these new primitive procedures(and any others that you think might be useful). Check through the code to figure out where this is done. In order to make these changes visible in the evaluator you'll need to rebuild the global environment (refresh-global-environment Show your changes to the evaluator, and turn in a demonstration of your extended evaluator working correctly Computer Exercise 2: Changing style. In MITScheme, if expressions are allowed to lack an alternative expression, as in the followingSince environments are, in general, complex circular list structures, we have set Scheme's printer so that it will not go into an infinite loop when asked to print a circular list. (See the descriptions of *unparser-list￾depth-limit* and *unparser-list-breadth-limit* in the Scheme reference manual.) You will notice that when you have run driver-loop, the mode line (bar at the bottom of edwin with the buffer name, along with (Scheme: listen)) will display (Scheme Meval: listen) instead. This indicates that meval will be receiving anything you C-x C-e, instead of (regular) MITScheme. In order to give you further warning when you accidentally send things to Meval instead of MITScheme, the *warn-meval-define* variable controls whether Meval will print out warnings if the define you're evaluating is binding a variable that is also bound in MITScheme. Computer Exercise 1: Exploring Meval. Load the code files into your Scheme environment. To begin using the Scheme interpreter defined by this file, evaluate (driver-loop). Notice how it now gives you a new prompt, in order to alert you to the fact that you are now "talking" to this new interpreter. Try evaluating some simple expressions in this interpreter. Note that this interpreter has no debugging mechanism -- that is, if you hit an error, you will be thrown into the debugger for the underlying Scheme. This can be valuable in helping you to debug your code for the new interpreter, but you will need to restart the interpreter. You may quickly notice that some of the primitive procedures about which Scheme normally knows are missing in m-eval. These include some simple arithmetic procedures (such as *) and procedures such as cadr, cddr, newline. Extend your evaluator by adding these new primitive procedures (and any others that you think might be useful). Check through the code to figure out where this is done. In order to make these changes visible in the evaluator, you'll need to rebuild the global environment: (refresh-global-environment) Show your changes to the evaluator, and turn in a demonstration of your extended evaluator working correctly. Computer Exercise 2: Changing style. In MITScheme, if expressions are allowed to lack an alternative expression, as in the following:
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有