Skip to content

Commit 98d6110

Browse files
committed
Clean up iniquity notes.
1 parent 28346c3 commit 98d6110

File tree

1 file changed

+21
-30
lines changed

1 file changed

+21
-30
lines changed

www/notes/iniquity.scrbl

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111

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

14-
@(ev '(require rackunit a86))
15-
@(ev `(current-directory ,(path->string (build-path langs "iniquity"))))
16-
@(void (ev '(with-output-to-string (thunk (system "make runtime.o")))))
17-
@(for-each (λ (f) (ev `(require (file ,f))))
18-
'("interp.rkt" "compile.rkt" "ast.rkt" "parse.rkt" "types.rkt"))
14+
@(ev '(require rackunit a86 iniquity))
1915

2016
@(define (shellbox . s)
2117
(parameterize ([current-directory (build-path langs "iniquity")])
@@ -652,37 +648,32 @@ single list:
652648
Here's an example of the code this compiler emits:
653649

654650
@ex[
655-
(asm-display
656-
(compile
657-
(parse '(define (double x) (+ x x)) '(double 5))))
651+
(compile (parse '(define (double x) (+ x x))
652+
'(double 5)))
658653
]
659654

660655
And we can confirm running the code produces results consistent with
661656
the interpreter:
662657

663658
@ex[
664-
(current-objs '("runtime.o"))
665-
(define (run . p)
666-
(bits->value (asm-interp (compile (apply parse p)))))
667-
668-
(run '(define (double x) (+ x x))
669-
'(double 5))
670-
671-
(run '(define (tri x)
672-
(if (zero? x)
673-
0
674-
(+ x (tri (sub1 x)))))
675-
'(tri 9))
676-
677-
(run '(define (even? x)
678-
(if (zero? x)
679-
#t
680-
(odd? (sub1 x))))
681-
'(define (odd? x)
682-
(if (zero? x)
683-
#f
684-
(even? (sub1 x))))
685-
'(even? 101))
659+
(exec (parse '(define (double x) (+ x x))
660+
'(double 5)))
661+
662+
(exec (parse '(define (tri x)
663+
(if (zero? x)
664+
0
665+
(+ x (tri (sub1 x)))))
666+
'(tri 9)))
667+
668+
(exec (parse '(define (even? x)
669+
(if (zero? x)
670+
#t
671+
(odd? (sub1 x))))
672+
'(define (odd? x)
673+
(if (zero? x)
674+
#f
675+
(even? (sub1 x))))
676+
'(even? 101)))
686677
]
687678

688679
The complete compiler code:

0 commit comments

Comments
 (0)