@@ -14,6 +14,73 @@ Submissions should be made on Gradescope.
1414
1515There are several projects to choose from, described below.
1616
17+ In addition the source code for your project, you must write a 2-page
18+ document which gives a summary of your work and describes how your
19+ project is implemented.
20+
21+
22+ @section{Multiple return values}
23+
24+ Racket, Scheme, and even x86 support returning more than one value
25+ from a function call. Implement Racket's @racket[let-values ] and
26+ @racket[values] forms to add multiple return values.
27+
28+ You may choose to implement this feature for any language that is
29+ @seclink["Iniquity " ]{Iniquity} or later for a maximum 95% of the
30+ possible points. For 100% you'll need to implement the feature for
31+ Loot or later.
32+
33+ Here are the key features that need to be added:
34+
35+ @itemlist[
36+
37+ @item{@racket[(values _e1 ... _en)] will evaluate @racket[_e1] through
38+ @racket[_en] and then ``return'' all of their values.}
39+
40+ @item{@racket[(let-values ([(_x1 ... _xn) _e]) _e0)] will evaluate
41+ @racket[_e], which is expected to be an expression that produces
42+ @racket[_n] values, which are bound to @racket[_x1] through
43+ @racket[_xn] in the body expression @racket[_e0].}
44+
45+ ]
46+
47+
48+ Here are some examples to help illustrate:
49+
50+ @ex[
51+
52+ (let-values ([(x y) (values 1 2 )]) (+ x y))
53+
54+ (let-values ([(x) (values 1 )]) (add1 x))
55+
56+ (let-values ([() (values)]) 7 )
57+
58+ (define (f x)
59+ (values x (+ x 1 ) (+ x 2 )))
60+
61+ (let-values ([(x y z) (f 5 )])
62+ (cons x (cons y (cons z '() ))))
63+
64+ (add1 (values 5 ))
65+
66+ (let ((x (values 5 )))
67+ (add1 x))
68+
69+ ]
70+
71+ Any time an expression produces a number of values that doesn't match
72+ what the surrounding context expects, an error should be signalled.
73+
74+ @ex[
75+
76+ (eval:error (add1 (values 1 2 )))
77+
78+ (eval:error (let-values ([(x y) 2 ]) x))
79+
80+ ]
81+
82+
83+
1784@section{Exceptions and Exception Handling}
1885
1986Exceptions and exception handling mechanisms are widely used in modern
@@ -23,7 +90,7 @@ programming languages. Implement Racket's @racket[raise] and
2390You may choose to implement this feature for any language that is
2491@seclink["Iniquity " ]{Iniquity} or later for a maximum 95% of the
2592possible points. For 100% you'll need to implement the feature for
26- Perp and do the additional requirements below .
93+ Loot or later .
2794
2895@subsection{Requirements}
2996
@@ -105,6 +172,7 @@ stack. If the body expression returns normally, the top-most handler
105172should be removed. When a raise happens, the top-most handler is
106173popped and used.
107174
175+ @;{
108176@subsection{Additional requirements}
109177
110178To receive full credit, you will to add the above features to Perp and
@@ -126,18 +194,10 @@ This enables user-programs to handle run-time errors like this:
126194(The @racket[cm] field can be ignored; you can always populate it with
127195@racket[#f ] if you'd like. It's there just for consistency with
128196Racket's @racket[exn:fail].)
197+ }
129198
130199
131200
132-
133-
134- There will be a final course project to be completed over the last
135- several weeks of the course. The project will involve extending the
136- design and implementation of the programming language and its compiler
137- that we will develop throughout the semester.
138-
139- Details of the project will be released later in the semester.
140-
141201@;{
142202For your project you should turn in your extension code, a directory
143203of examples that showcase your extension and the differences in
0 commit comments