Skip to content

Commit 8e3e0c8

Browse files
committed
More Shakedown fixes
1 parent c884784 commit 8e3e0c8

File tree

6 files changed

+24
-23
lines changed

6 files changed

+24
-23
lines changed

www/notes/shakedown/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ clib.o: clib.c types.h
2424
%.o: %.s
2525
nasm -f $(format) -o $@ $<
2626

27-
%.s: %.rkt
27+
%.s: %.shk
2828
racket -t compile-file.rkt -m $< > $@
2929

3030
clean:

www/notes/shakedown/clib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
#include "types.h"
55

66
int64_t c_fun() {
7-
puts("yo yo yo");
7+
puts("Hello, from C!");
88
return (42 << imm_shift);
99
}

www/notes/shakedown/compile-file.rkt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
(asm-display (compile (sexpr->prog p)))))))
1616

1717
(define (read-program)
18-
(regexp-match "^#lang racket" (current-input-port))
1918
(read))

www/notes/shakedown/example.shk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
#lang racket
21
(let ((y (ccall c_fun))) ((lambda (x) y) 11))

www/notes/shakedown/test/compile.rkt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#lang racket
22
(require "../compile.rkt"
3+
"../syntax.rkt"
34
"../asm/interp.rkt"
45
rackunit
56
redex/reduction-semantics)
67

78
(define (run e)
8-
(asm-interp (compile e)))
9+
(asm-interp (compile (sexpr->prog e))))
910

1011
(check-equal? (run 7) 7)
1112
(check-equal? (run -8) -8)
@@ -118,19 +119,19 @@
118119
'())))))
119120
'(1 -1))
120121

121-
(check-equal?
122-
(run
123-
'(begin (define (map f ls)
124-
(begin (define (mapper ls)
125-
(if (empty? ls)
126-
'()
127-
(cons (f (car ls)) (mapper (cdr ls)))))
128-
(mapper ls)))
129-
(map (λ (f) (f 0))
130-
(cons (λ (x) (add1 x))
131-
(cons (λ (x) (sub1 x))
132-
'())))))
133-
'(1 -1))
122+
;(check-equal?
123+
; (run
124+
; '(begin (define (map f ls)
125+
; (begin (define (mapper ls)
126+
; (if (empty? ls)
127+
; '()
128+
; (cons (f (car ls)) (mapper (cdr ls)))))
129+
; (mapper ls)))
130+
; (map (λ (f) (f 0))
131+
; (cons (λ (x) (add1 x))
132+
; (cons (λ (x) (sub1 x))
133+
; '())))))
134+
; '(1 -1))
134135

135136
(check-equal? (run
136137
'(let ((id (λ (x) x)))

www/notes/shakedown/test/interp.rkt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@
148148
'())))))
149149
'(1 -1)))
150150

151-
(test-suite
152-
(λ (e)
153-
(match (interp e)
154-
[(? procedure?) 'procedure]
155-
[v v])))
151+
; TODO: Not sure if I actually want to write an interpreter for this as it's
152+
; mostly about the System V calling convention
153+
;(test-suite
154+
; (λ (e)
155+
; (match (interp e)
156+
; [(? procedure?) 'procedure]
157+
; [v v])))

0 commit comments

Comments
 (0)