![]() |
Jupyter at Bryn Mawr College |
|
|
Public notebooks: /services/public/dblank / CS245 Programming Languages / 2016-Fall / Labs |
In this assignment we will add primitive functions, variables, and user-defined functions to our S-Calc language.
By-line below:
Copy and paste your functions from Lab03 here. Only include the functions and definitions that you need.
You may use Doug's solution if you wish.
Check to make sure all of Lab03 still works.
You will want to refer to https://athena.brynmawr.edu/jupyter/hub/dblank/public/CS245%20Programming%20Languages/2016-Fall/Notebooks/Adding%20Functions%20and%20Variables%20to%20S-Calc.ipynb and add any needed functions.
After this step, evaluator_apply should just be:
def evaluator_apply(op, operands):
return op(operands)
Make sure you pass evaluator env whenever called (even in Map).
Test these thoroughly here before proceeding.
Parsing a lambda should produce a proc-exp.
Evaluating a proc-exp should produce a closure-exp.
You now need to change apply_evaluator again to allow the application of closures.
As per usual, please reflect deeply on this week's lab. What was challenging, easy, or surprising? Connect the topics onto what you already know.