Programming Languages (CSC-302 98S)
Outline of Class 39: Wrapup
Held: Friday, May 8, 1998
- The final is Monday at 9am. A review
sheet is now available.
- I have finished grading
- I only graded the first five problems for a number of reasons.
- Given the number of times I've tried to emphasize thorough testing
of sorting routines, I am extremely disappointed with your tests
of the sorting routines.
- An answer key is available.
- Today we will have a posiquiz. The quiz can only have a positive
affect on your grade in the class.
- You will need the
the section of the Scheme report on syntax and semantics for
- There are two candidates for a visiting math position coming next week.
They will be speaking on Monday night and Wednesday night. I think
that the department will be providing Pizza. I'll offer the added
incentive that anyone who comes to a talk and sends the department
a summary of your reactions to the candidate gets one point of extra
credit in the class.
- Note that I've finally determined the meaning of bp's warning
singleton_variables. This warning occurs when you only use
a variable once in a predicate definition (making it somewhat useless
except for notational convenience).
- You will note that there are a large number of domains for the
Scheme semantics (approximately eightteen). This helps us
distinguish the roles of a number of things.
- What are some particularly interesting ones?
- Scheme admits that values will be stored in memory (this is necessary
for things like set!) and that there is a separation between variable
name and value of the variable.
L is used for locations.
- An environment maps each identifier to a location
Surprisingly, it seems that every identifier has a location.
A closer reading of the semantics suggests that
undefined may be used.
- A store maps each location to a (value,boolean) pair.
It appears that the boolean is used to indicate whether or not
the location is allocated.
- There are three kinds of constructed objects: pairs, vectors,
- Each has an additional boolean flag. This indicates whether or not
the object is mutable (can be changed).
- Continuations are used. There are two kinds,
- Command continuations map a store to an answer.
- Expression continuations map a sequence of expressions to a
- Scheme (or at least the Scheme semantics)
permits a number of kinds of values (symbols, characters,
numbers, pairs, vectors, strings, procedures, and some special ones).
- Scheme has four semantic functions that assign meaning to variations
of the basic syntactic categories.
- A meaning-of-constant function assigns meanings to constants. That
is left as an exercise to the implementer (wich important ones defined on
the subsequent page). The meaning of a constant is the value of that
- A meaning-of-expression function assigns meanings to expressions.
The meaning of an expression is based on its environment and what
is done with the expression. Why "what is done with the expression"?
For similar reasons to those in the SIMPLE semantics: an expression
may update store or environemnt.
- You may note that the meaning of an expression doesn't seem to depend
on its store. Why not? Because the store is cleverly hidden in the
result of the function.
- A meaning-of-expression-sequence function does something similar.
- A meaning-of-command-sequence function also does something similar,
but uses a command-continuation instead of the expression continuation.
What's the difference? One uses the result of the expression and
- Let's consider the first few rules for the meaning-of-expression function.
- What is the meaning of a constant expression?
- It is a function that takes a environment and an expression
continuation and returns a command continuation.
- The environment isn't needed (sonstants aren't evaluated in the
context of an environment).
- The meaning of the constant is determined. That meaning is a value.
- The continuation is called on the value using the send
- What does send do? It helps support the type structure.
Since expression continuations work from sequences of
expressions, it turns a single argument into a sequence before
calling the continuation.
- Why didn't they just write
I have no idea.
- What is the meaning of an identifier?
- It is a function that takes an environment and an
expression continuation and returns a command continuation.
- It has three steps
- We look up the identifier in the environment
- We make sure the identifier is defined
- We call the continuation
- How are those expressed?
- lookup looks up an identifier in an environment. It's
not clear why this is all that helpful, except for readability.
- single takes a single-argument function and makes it
an expression continuation.
- hold takes a location and an expression continuation,
grabs the value at that location, and calls the continuation.
- It has a very strange definition. Note that while it seems to be
a function of three arguments, it is typed as a function of
two arguments. This is because
C is a function
- This is also why the store is repeated in its definition.
- What is the meaning of the application of an expression to a
sequence of expressions?
- It's based on the meaning of all the subexpressions
- The subexpressions are evaluated in an implementation-dependent
- The meaning of the expressions is determined in the current
environment (we'll need to check the meaning-of-expression-sequence
definitions to see how each affects the next).
- The evaluated first subexpression is applied to the rest.
- The contination is applied to the result.
Our summary of what we learned will be based on
the review sheet for the final.
- My mother taught Psychology at Boston University for over thirty
years. ("Aha, that explains SamR's personality.") She ended every
class with the same statement. I try to do the same, although the
statement is filtered through my sensibilities.
Most of us will take or teach other classes. However, this one is
unique; none will ever be quite like this it for a number of reasons.
The people in the class made it what it was. We should acknoledge
each other's contributions and commit ourselves to making similar
contributions in future classes. I thank all of you for your
- Mom also makes a statement on the order of
While I enjoyed having you in my class, I'm also happy to have you
move on to other things. Like any parent, I've enjoyed seeing
you grow, but also want you to test your own wings.
- Mom also tells a story of an elementary school teacher she had worked
with who was leaving her job. Mom stopped by to give the teacher a
goodbye present. The teacher cried. Mom said "I expect that you've
been crying all day as you said goodbye to your students." The teacher
said "No, I forgot to say goodbye." Since then mom has always made it
a point to say goodbye to her classes. I encourage you to say goodbye
to your friends and colleagues who you may not see again.