Com Sci 221 --- Programming Languages
Assignment #6 --- Autumn 2000
Due Monday, 13 November
Last modified: Mon Nov 6 11:17:13 CST 2000
No program execution is needed in this assignment.
- Write a single procedure declaration and a single call to the
procedure that executes correctly with no errors and produces three
different results with each of call by value-result, call
by reference, and call by name. Make the procedure
declaration as simple as possible, and make it as helpful as possible
in understanding why the three calling methods are different. State
the three different results for the three calling methods. Hint: you
need to pass an array reference as a parameter.
- Consider the program of problems 5.4-5.5 (Figure 5.29) on pages
199-200 of the text.
- Give a very simple context-free grammar for the strings of
balanced parentheses of the three types
()
,
<>
, []
whose parse trees have exactly the
same shape as the activation trees for the program.
- Display the trees for the example
<()(())[<>]>
.
- Explain very briefly what components of the program
correspond to the productions in the grammar.
By the way, you've just invented recursive descent parsing.