Skip to content

Commit 5febfae

Browse files
committed
Revised assignment schedule, publish assign 5.
1 parent 43f0692 commit 5febfae

File tree

6 files changed

+101
-8
lines changed

6 files changed

+101
-8
lines changed

www/assignments.scrbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@include-section{assignments/7.scrbl}
1313
@include-section{assignments/8.scrbl}
1414
@include-section{assignments/9.scrbl}
15-
@include-section{assignments/10.scrbl}
15+
@;include-section{assignments/10.scrbl}
1616

1717

1818
@;{assignment 8: quote in general, and quasiquote}

www/assignments/5.scrbl

Lines changed: 97 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,106 @@
11
#lang scribble/manual
22
@(require "../defns.rkt")
3-
@title[#:tag "Assignment 5" #:style 'unnumbered]{Assignment 5: When and unless}
3+
@title[#:tag "Assignment 5" #:style 'unnumbered]{Assignment 5: Let There Be (Many) Variables}
44

55
@(require (for-label a86/ast (except-in racket ...)))
66

77
@bold{Due: @assign-deadline[5]}
88

9-
Details of this assignment will be released later in the semester.
9+
The goal of this assignment is to extend a compiler with binding forms
10+
that can take any number of arguments.
11+
12+
@section[#:tag-prefix "a5-" #:style 'unnumbered]{Overview}
13+
14+
For this assignment, you are given a @tt{fraud-plus.zip} file on ELMS
15+
with a starter compiler similar to the @seclink["Fraud"]{Fraud}
16+
language we studied in class.
17+
18+
@section[#:tag-prefix "a5-" #:style 'unnumbered]{Fraud+}
19+
20+
The Fraud+ language extends the Fraud language we studied in class with some
21+
new features:
22+
23+
@itemlist[
24+
25+
@item{The features added in @seclink["Assignment 4"]{Assignment 4}, namely:
26+
27+
@itemlist[
28+
29+
@item{@racket[abs], @racket[-], and @racket[not]}
30+
@item{@racket[cond]}
31+
@item{@racket[case]}
32+
33+
]}
34+
35+
@item{New primitives @racket[integer?] and @racket[boolean?].}
36+
37+
@item{An extended @racket[let] form that can bind multiple variables at once.}
38+
39+
@item{Back-referencing @racket[let*] form that can bind multiple variables at once.}
40+
41+
]
42+
43+
@subsection[#:tag-prefix "a5-" #:style 'unnumbered]{From Dupe++ to Fraud+}
44+
45+
Implement the @racket[abs], unary @racket[-], and @racket[not] operations and
46+
the @racket[cond] and @racket[case] forms from
47+
@seclink["Assignment 4"]{Assignment 4} by modifying @tt{interp.rkt},
48+
@tt{interp-prim.rkt}, @tt{compile.rkt}, and @tt{compile-op.rkt}. You can
49+
start from your previous code, but you will need to update it to work for the
50+
code you are given. What's essentially left for you to do is to make sure to
51+
correctly signal an error (@racket['err]) when these constructs are
52+
applied to the wrong type of argument.
53+
54+
While you're at it, implement the predicates @racket[integer?] and
55+
@racket[boolean?] for checking the type of an argument, modeled by the
56+
@racket[char?] predicate that was covered in the lectures.
57+
58+
@subsection[#:tag-prefix "a5-" #:style 'unnumbered]{Generalizing Let}
59+
60+
The Fraud language has a @tt{let} form that binds a single variable in the
61+
scope of some expression. This is a restriction of the more general form of
62+
@racket[let] that binds any number of expressions. So, for example,
63+
64+
@racketblock[
65+
(let ((x 1) (y 2) (z 3))
66+
_e)
67+
]
68+
69+
simultaneously binds @racket[x], @racket[y], and @racket[z] in the scope of
70+
@racket[_e].
71+
72+
The syntax of a @racket[let] expression allows any number of binders to occur,
73+
so @racket[(let () _e)] is valid syntax and is equivalent to @racket[_e].
74+
75+
The binding of each variable is only in-scope within the body, @bold{not} in
76+
the right-hand sides of any of the @racket[let]. So, for example,
77+
@racketblock[(let ((x 1) (y x)) 0)] is a syntax error because the occurrence of
78+
@racket[x] is not bound.
79+
80+
81+
@subsection[#:tag-prefix "a5-" #:style 'unnumbered]{Back-Referencing Let}
82+
83+
Similar to @racket[let], there is also @racket[let*] that can also bind any
84+
number of expressions. The difference is that previous bindings are available
85+
in the right-hand sides of subsequent bindings. For example,
86+
87+
@racketblock[
88+
(let* ((x 1) (y 2) (z (add1 y)))
89+
_e)
90+
]
91+
92+
binds @racket[x] to 1, @racket[y] to 2, and @racket[z] to 3 in
93+
the scope of @racket[_e].
94+
95+
The syntax of a @racket[let*] expression allows any number of binders to occur,
96+
so @racket[(let* () _e)] is valid syntax and is equivalent to @racket[_e].
97+
98+
Unlike @racket[let], @racketblock[(let* ((x 1) (y x)) 0)] is @emph{not} a
99+
syntax error. However, bindings are only available forward, so
100+
@racketblock[(let* ((x y) (y 1)) 0)] @emph{is} a syntax error.
101+
102+
103+
10104

11105
@;{
12106
The goal of this assignment is to extend the language developed in
@@ -20,7 +114,7 @@ The Extort+ language extends Extort in the follow ways:
20114
@itemlist[
21115
@item{adding @racket[when],}
22116
@item{adding @racket[unless], and}
23-
@item{bringing forward all the features of Dupe+.}
117+
@item{bringing forward all the features of Dupe++.}
24118
]
25119

26120

www/assignments/6.scrbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#lang scribble/manual
22
@(require "../defns.rkt")
3-
@title[#:tag "Assignment 6" #:style 'unnumbered]{Assignment 6: Binding many variables}
3+
@title[#:tag "Assignment 6" #:style 'unnumbered]{Assignment 6: List primitives and n-ary primitives}
44

55
@(require (for-label a86 (except-in racket ...)))
66

www/assignments/8.scrbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#lang scribble/manual
22
@(require "../defns.rkt")
3-
@title[#:tag "Assignment 8" #:style 'unnumbered]{Assignment 8: List primitives}
3+
@title[#:tag "Assignment 8" #:style 'unnumbered]{Assignment 8: Functions with default arguments}
44

55
@(require (for-label a86 (except-in racket ...)))
66

www/assignments/9.scrbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#lang scribble/manual
22
@(require "../defns.rkt")
3-
@title[#:tag "Assignment 9" #:style 'unnumbered]{Assignment 9: Functions with default arguments}
3+
@title[#:tag "Assignment 9" #:style 'unnumbered]{Assignment 9: Patterns}
44

55
@(require (for-label a86 (except-in racket ...)))
66

www/defns.rkt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
"Thursday, September 18, 11:59PM"
5959
"Thursday, September 25, 11:59PM"
6060
"Thursday, October 2, 11:59PM"
61-
"Thursday, October 9, 11:59PM"
6261
"Thursday, October 23, 11:59PM"
6362
"Thursday, October 30, 11:59PM"
6463
"Thursday, November 6, 11:59PM"

0 commit comments

Comments
 (0)