Skip to content

Commit 4892c8d

Browse files
committed
Assignment 5
1 parent 8b5d3c8 commit 4892c8d

3 files changed

Lines changed: 52 additions & 18 deletions

File tree

www/assignments.scrbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@include-section{assignments/2.scrbl}
88
@include-section{assignments/3.scrbl}
99
@include-section{assignments/4.scrbl}
10-
@;include-section{assignments/5.scrbl}
10+
@include-section{assignments/5.scrbl}
1111
@;include-section{assignments/6.scrbl}
1212
@;include-section{assignments/7.scrbl}
1313

www/assignments/5.scrbl

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
@(require "../notes/ev.rkt")
99

10-
@bold{Due: Tues, April 28, 11:59PM EST}
10+
@bold{Due: Friday, Oct 30, 11:59PM EDT}
1111

12-
@(define repo "https://classroom.github.com/a/Q8hyY0yo")
12+
@(define repo "https://classroom.github.com/a/fqM9KeO1")
1313

1414
The goal of this assignment is to extend a compiler with data types
1515
that require memory allocation and dereferencing.
@@ -73,6 +73,21 @@ If you want to understand the details of how strings are implemented in
7373
the run-time system. See the function @tt{print_string()}
7474
in @tt{main.c}.
7575
76+
In order to get all the points for this section of the assignment you will
77+
need to modify the following files:
78+
79+
@itemlist[
80+
81+
@item{@tt{compile.rkt}}
82+
83+
@item{@tt{syntax.rkt}}
84+
85+
]
86+
87+
As usual, the code in @tt{ast.rkt} will need to be studied in order to
88+
understand the structure of the AST and how to traverse/operate on
89+
Hustle+ programs.
90+
7691
@section[#:tag-prefix "a5-" #:style 'unnumbered]{More operations}
7792
7893
Add the following operations to the Hustle+ language:
@@ -105,10 +120,32 @@ two booleans are equal.}
105120
106121
]
107122
123+
Tests for these primitives have not been provided in @tt{test/compile.rkt},
124+
therefore you will need to write appropriate tests for these primitives.
125+
126+
In order to get all the points for this section of the assignment you will
127+
need to modify the following files:
128+
129+
@itemlist[
130+
131+
@item{@tt{compile.rkt}}
132+
133+
@item{@tt{syntax.rkt}}
134+
135+
@item{@tt{test/compile.rkt}}
136+
137+
]
138+
108139
@section[#:tag-prefix "a5-" #:style 'unnumbered]{Extending the Parser}
109140
110-
The parser has been extended from the Fraud+ parser for the Hustle+ language
111-
based on the following grammar:
141+
You should not need to make any changes to @tt{lex.rkt} or to @tt{parse.rkt},
142+
but you do need to understand the structure of the resulting AST, which is why
143+
the information below is provided. The grammar, along with the definitions and
144+
utility functions in @tt{ast.rkt} provide all the information necessary to
145+
work with the AST in implementing the new features of Hustle+.
146+
147+
The parser has been extended @emph{for you} from the Fraud+ parser for the
148+
Hustle+ language based on the following grammar:
112149
113150
@verbatim{
114151
<expr> ::= integer
@@ -200,18 +237,15 @@ The lexer will take care of reading the @tt{#lang racket} header and
200237
remove any whitespace.
201238
202239
The code in @tt{parse.rkt} implements the parser which constructs an
203-
s-expression representing a valid Hustle+ expression, if possible, from a list
240+
AST representing a valid Hustle+ expression, if possible, from a list
204241
of tokens.
205242
206-
As an example, @racket[parse] should produce @racket['(add1 (sub1 7))]
243+
As an example, @racket[parse] should produce
244+
@racket[(prim-e 'add1 (list (prim-e 'sub1 (list (int-e 7))))))]
207245
if given
208246
209247
@racketblock['(lparen (prim add1) lparen (prim sub1) 7 rparen rparen eof)]
210248
211-
You should not need to make any changes to @tt{lex.rkt} or to @tt{parse.rkt},
212-
but you do need to understand the structure of the resulting AST, which is why
213-
the information above was provided.
214-
215249
@section[#:tag-prefix "a5-" #:style 'unnumbered]{Testing}
216250
217251
You can test your code in several ways:

www/schedule.scrbl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@
4747
(list @wk{10/12}
4848
@bold{@seclink["Midterm_1"]{M1}}
4949
@elem{No lecture (exam)}
50-
@elem{@secref["Hustle"]})
50+
@elem{Exam Q+A})
5151

5252
(list @wk{10/19}
5353
""
54-
@elem{@secref["Iniquity"]}
55-
@elem{@secref["Jig"]})
54+
@elem{@secref["Hustle"]}
55+
@elem{@secref["Iniquity"]})
5656

5757
(list @wk{10/26}
5858
@seclink["Assignment 5"]{A5}
59-
@elem{@secref["Knock"]}
60-
@elem{Digression: Taking a look at ASTs})
59+
@elem{@secref["Jig"]}
60+
@elem{@secref["Knock"]})
6161

6262
(list @wk{11/02}
6363
""
64-
@elem{@secref["Loot"]}
65-
@elem{@secref["Loot"] (cont.)})
64+
@elem{Digression: Taking a look at ASTs}
65+
@elem{@secref["Loot"]})
6666

6767
(list @wk{11/09}
6868
@bold{@seclink["Midterm_2"]{M2}}

0 commit comments

Comments
 (0)