File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 66@(require "../notes/ev.rkt "
77 "../notes/utils.rkt " )
88
9-
109@bold{Due: @assign-deadline[8 ]}
1110
11+ @(ev '(require knock-plus))
12+
1213The goal of this assignment is to extend a compiler with new pattern
1314matching forms for matching lists, vectors, and predicates.
1415
@@ -115,6 +116,30 @@ the name of a user defined function.
115116 [_ #f ])
116117]
117118
119+ @section[#:tag-prefix "a8- " #:style 'unnumbered ]{Representing the syntax of patterns}
120+
121+ The AST of patterns is extended as follows:
122+
123+ @#reader scribble/comment-reader
124+ (racketblock
125+ ;; type Pat = ...
126+ ;; | (List [Listof Pat])
127+ ;; | (Vect [Listof Pat])
128+ ;; | (Pred Id)
129+ )
130+
131+ The parser includes a @racket[parse-pattern] function that parses a
132+ single pattern:
133+
134+ @ex[
135+ (parse-pattern 'x )
136+ (parse-pattern '(cons x y))
137+ (parse-pattern '(list x y z))
138+ (parse-pattern '(vector x y z))
139+ (parse-pattern '(? f?))
140+ ]
141+
142+
118143
119144@section[#:tag-prefix "a8- " #:style 'unnumbered ]{Submitting}
120145
You can’t perform that action at this time.
0 commit comments