Skip to content

Commit 1c426d3

Browse files
committed
Update Fraud notes
1 parent 871ef56 commit 1c426d3

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

www/notes/fraud.scrbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@(define codeblock-include (make-codeblock-include #'h))
1414

1515
@(ev '(require rackunit a86))
16-
@(ev `(current-directory ,(path->string (build-path notes "hustle"))))
16+
@(ev `(current-directory ,(path->string (build-path notes "fraud"))))
1717
@(void (ev '(with-output-to-string (thunk (system "make runtime.o")))))
1818
@(for-each (λ (f) (ev `(require (file ,f))))
1919
'("interp.rkt" "compile.rkt" "ast.rkt" "parse.rkt" "types.rkt" "translate.rkt"))

www/notes/knock.scrbl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#lang scribble/manual
22

3-
@(require (for-label (except-in racket ...)))
3+
@(require (for-label (except-in racket compile ...) a86))
44
@(require redex/pict
55
racket/runtime-path
66
scribble/examples
@@ -10,8 +10,11 @@
1010

1111
@(define codeblock-include (make-codeblock-include #'h))
1212

13-
@(for-each (λ (f) (ev `(require (file ,(path->string (build-path notes "knock" f))))))
14-
'("interp.rkt" "compile.rkt" "syntax.rkt" "asm/interp.rkt" "asm/printer.rkt"))
13+
@(ev '(require rackunit a86))
14+
@(ev `(current-directory ,(path->string (build-path notes "knock"))))
15+
@(void (ev '(with-output-to-string (thunk (system "make runtime.o")))))
16+
@(for-each (λ (f) (ev `(require (file ,f))))
17+
'("interp.rkt" "compile.rkt" "ast.rkt" "parse.rkt" "types.rkt"))
1518

1619
@title[#:tag "Knock"]{Knock: first-class function (pointers)}
1720

@@ -139,8 +142,9 @@ We can verify that the compiler works for programs that use functions
139142
like before:
140143

141144
@ex[
145+
(current-objs '("runtime.o"))
142146
(asm-interp
143-
(compile (sexpr->prog '(begin (define (f x)
147+
(compile (parse '(begin (define (f x)
144148
(if (zero? x)
145149
0
146150
(add1 (call (fun f) (sub1 x)))))
@@ -150,16 +154,18 @@ like before:
150154
But it also works when functions are put in lists:
151155

152156
@ex[
157+
(current-objs '("runtime.o"))
153158
(asm-interp
154-
(compile (sexpr->prog '(begin (define (f x) x)
159+
(compile (parse '(begin (define (f x) x)
155160
(call (car (cons (fun f) '())) 7)))))
156161
]
157162

158163
And functions that produce functions:
159164

160165
@ex[
166+
(current-objs '("runtime.o"))
161167
(asm-interp
162-
(compile (sexpr->prog '(begin (define (f x) (fun h))
168+
(compile (parse '(begin (define (f x) (fun h))
163169
(define (h y) y)
164170
(call (call (fun f) 5) 9)))))
165171
]

0 commit comments

Comments
 (0)