Last modified: Fri Jan 27 14:53:41 1995
Other versions:
and the slightly unusual, but extremely useful, behavior of and and or under the set of rulesif T then <alpha> else <beta> => <alpha> if F then <alpha> else <beta> => <beta>
Comment on the problems involved in trying to do outermost evaluation on a stack with sets of rules such asF and <beta> => F T and <beta> => <beta> T or <beta> => T F or <beta> => <beta>
<alpha> or T => T <alpha> or F => <alpha>
<alpha> or T => T T or <beta> => T F or F => F
This is a deliberately open-ended question. You will get more credit the more insight you can generate about why each set of rules is not only problematic, but more problematic than the ones before. Long answers, however, are not recommended. It is possible in each case to get the essential points in a few sentences.if <alpha> then <beta> else <beta> => <beta> if T then <alpha> else <beta> => <alpha> if F then <alpha> else <beta> => <beta>
i := 0;
While i<=20 but i does not satisfy the desired
condition do
i := i+1
end while
When the loop completes, either i satisfies the desired
condition, or there is no way to satisfy it, and i = 21.
Realize the structure above as well as you can in Pascal and C.
This is not necessarily the best program structure for the given
task, but use it anyway. You should come closer in C that in
Pascal, by using the conditional forms of and and/or or (written
``&&'' and ``||''). Demonstrate your programs on a set of
inputs that demonstrates the interesting qualities of the
programs.