|
7 | 7 |
|
8 | 8 | @(require "../notes/ev.rkt") |
9 | 9 |
|
10 | | -@bold{Due: Tues, April 28, 11:59PM EST} |
| 10 | +@bold{Due: Friday, Oct 30, 11:59PM EDT} |
11 | 11 |
|
12 | | -@(define repo "https://classroom.github.com/a/Q8hyY0yo") |
| 12 | +@(define repo "https://classroom.github.com/a/fqM9KeO1") |
13 | 13 |
|
14 | 14 | The goal of this assignment is to extend a compiler with data types |
15 | 15 | that require memory allocation and dereferencing. |
@@ -73,6 +73,21 @@ If you want to understand the details of how strings are implemented in |
73 | 73 | the run-time system. See the function @tt{print_string()} |
74 | 74 | in @tt{main.c}. |
75 | 75 |
|
| 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 | +
|
76 | 91 | @section[#:tag-prefix "a5-" #:style 'unnumbered]{More operations} |
77 | 92 |
|
78 | 93 | Add the following operations to the Hustle+ language: |
@@ -105,10 +120,32 @@ two booleans are equal.} |
105 | 120 |
|
106 | 121 | ] |
107 | 122 |
|
| 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 | +
|
108 | 139 | @section[#:tag-prefix "a5-" #:style 'unnumbered]{Extending the Parser} |
109 | 140 |
|
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: |
112 | 149 |
|
113 | 150 | @verbatim{ |
114 | 151 | <expr> ::= integer |
@@ -200,18 +237,15 @@ The lexer will take care of reading the @tt{#lang racket} header and |
200 | 237 | remove any whitespace. |
201 | 238 |
|
202 | 239 | 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 |
204 | 241 | of tokens. |
205 | 242 |
|
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))))))] |
207 | 245 | if given |
208 | 246 |
|
209 | 247 | @racketblock['(lparen (prim add1) lparen (prim sub1) 7 rparen rparen eof)] |
210 | 248 |
|
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 | | -
|
215 | 249 | @section[#:tag-prefix "a5-" #:style 'unnumbered]{Testing} |
216 | 250 |
|
217 | 251 | You can test your code in several ways: |
|
0 commit comments