File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020@(ev '(require rackunit a86))
2121@(ev `(current-directory ,(path->string (build-path notes "knock " ))))
2222@(void (ev '(with-output-to-string (thunk (system "make runtime.o " )))))
23+ @(ev '(current-objs '("runtime.o " )))
2324@(for-each (λ (f) (ev `(require (file ,f))))
2425 '("interp.rkt " "compile.rkt " "ast.rkt " "parse.rkt " "types.rkt " "unload-bits-asm.rkt " ))
2526
@@ -672,6 +673,21 @@ expression:
672673 (Add rsp 8 )))) ; pop the saved value being matched
673674)
674675
676+ We can check that the compiler works for a complete example:
677+
678+ @ex[
679+ (define (run p)
680+ (unload/free (asm-interp (compile (parse p)))))
681+
682+ (run
683+ '[(define (length xs)
684+ (match xs
685+ ['() 0 ]
686+ [(cons x xs) (add1 (length xs))]))
687+ (length (cons 7 (cons 8 (cons 9 '() ))))])
688+ ]
689+
690+
675691
676692With these pieces in place , here's the complete compiler:
677693
Original file line number Diff line number Diff line change 7575
7676 (list @wk{11/9 }
7777 @bold{@seclink["Midterm_2 " ]{M2}}
78- @elem{(slack.) }
78+ @elem{@secref[ " Knock " ] }
7979 @elem{No lecture (exam)})
8080
8181 (list @wk{11/16 }
You can’t perform that action at this time.
0 commit comments