Skip to content

Commit 1ef7f6f

Browse files
committed
Draft of assign 6 and adjust to deadline schedule.
1 parent bc2fd20 commit 1ef7f6f

File tree

2 files changed

+88
-5
lines changed

2 files changed

+88
-5
lines changed

www/assignments/6.scrbl

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,92 @@
11
#lang scribble/manual
2-
@(require "../defns.rkt")
3-
@title[#:tag "Assignment 6" #:style 'unnumbered]{Assignment 6: List primitives and n-ary primitives}
2+
@(require "../defns.rkt"
3+
"../notes/ev.rkt")
4+
@title[#:tag "Assignment 6" #:style 'unnumbered]{Assignment 6: List and vector primitives}
45

56
@(require (for-label a86 (except-in racket ...)))
67

78
@bold{Due: @assign-deadline[6]}
89

9-
Details of this assignment will be released later in the semester.
10+
@(ev '(require hoax-plus))
11+
12+
The goal of this assignment is to gain proficiency with our
13+
representation of memory-allocated values by implementing a number of
14+
list and vector primitives.
15+
16+
@section[#:tag-prefix "a6-" #:style 'unnumbered]{Overview}
17+
18+
For this assignment, you are given a @tt{hoax-plus.zip} file on ELMS
19+
with a starter compiler similar to the @seclink["Hoax"]{Hoax}
20+
language we studied in class.
21+
22+
23+
@section[#:tag-prefix "a6-" #:style 'unnumbered]{Hoax+}
24+
25+
The Hoax+ language extends the Hoax language we studied in class with four
26+
new unary primitives:
27+
28+
@itemlist[
29+
@item{@racket[length]: given a list, computes its length.}
30+
@item{@racket[reverse]: given a list, computes a list with elements in the reverse order of the given list.}
31+
@item{@racket[list->vector]: given a list, computes a vector with elements in the order of the given list.}
32+
@item{@racket[vector->list]: given a vector, computes a list with elements in the order of the given vector.}
33+
]
34+
35+
Unlike past assignments, you do not need to bring forward in any
36+
features from earlier assignments.
37+
38+
@section[#:tag-prefix "a6-" #:style 'unnumbered]{List and vector primitves}
39+
40+
41+
The new primitives have been added to the parser and the interpreter.
42+
The behavior of compiled primitives should be consistent with the
43+
interpreter:
44+
45+
@ex[
46+
(interp (parse '(length '())))
47+
(interp (parse '(length (cons 1 (cons 2 '())))))
48+
(interp (parse '(length #f)))
49+
(interp (parse '(reverse '())))
50+
(interp (parse '(reverse (cons 1 (cons 2 '())))))
51+
(interp (parse '(reverse #f)))
52+
(interp (parse '(list->vector '())))
53+
(interp (parse '(list->vector (cons 1 (cons 2 '())))))
54+
(interp (parse '(list->vector #f)))
55+
(interp (parse '(vector->list (make-vector 0 #t))))
56+
(interp (parse '(vector->list (make-vector 2 #t))))
57+
(interp (parse '(vector->list #f)))
58+
]
59+
60+
The interpreter is consistent with Racket's own behavior, so if you're
61+
unsure about what your compiler should do, you can look to Racket (or
62+
the interpreter) for guidance:
63+
64+
@ex[
65+
(length '())
66+
(length (cons 1 (cons 2 '())))
67+
(eval:error (length #f))
68+
(reverse '())
69+
(reverse (cons 1 (cons 2 '())))
70+
(eval:error (reverse #f))
71+
(list->vector '())
72+
(list->vector (cons 1 (cons 2 '())))
73+
(eval:error (list->vector #f))
74+
(vector->list (make-vector 0 #t))
75+
(vector->list (make-vector 2 #t))
76+
(eval:error (vector->list #f))
77+
]
78+
79+
@subsection[#:tag-prefix "a6-" #:style 'unnumbered]{Testing}
80+
81+
A small number of test cases have been provided in
82+
@tt{test/test-runner.rkt}. There is function called @racket[test]
83+
that contains I/O-free test cases and another called @racket[test/io]
84+
that contains I/O tests. To run these tests, @tt{raco test
85+
test/interp.rkt} will test the interpreter and @tt{raco test
86+
test/compile.rkt} will test the compiler. You are encouraged to add
87+
your own tests.
88+
89+
@section[#:tag-prefix "a6-" #:style 'unnumbered]{Submitting}
90+
91+
To submit, use @tt{make} from within the @tt{hoax-plus} directory to
92+
create a zip file containing your work and submit it to Gradescope.

www/defns.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
"Thursday, September 25, 11:59PM"
6060
"Thursday, October 2, 11:59PM"
6161
"Thursday, October 23, 11:59PM"
62-
"Thursday, October 30, 11:59PM"
63-
"Thursday, November 6, 11:59PM"
62+
"Tuesday, November 4, 11:59PM"
63+
"Tuesday, November 11, 11:59PM"
6464
"Thursday, November 20, 11:59PM"
6565
"Thursday, December 4, 11:59PM")
6666
(sub1 i)))

0 commit comments

Comments
 (0)