File tree Expand file tree Collapse file tree 6 files changed +24
-23
lines changed
Expand file tree Collapse file tree 6 files changed +24
-23
lines changed Original file line number Diff line number Diff 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
3030clean :
Original file line number Diff line number Diff line change 44#include "types.h"
55
66int64_t c_fun () {
7- puts ("yo yo yo " );
7+ puts ("Hello, from C! " );
88 return (42 << imm_shift );
99}
Original file line number Diff line number Diff line change 1515 (asm-display (compile (sexpr->prog p)))))))
1616
1717(define (read-program)
18- (regexp-match "^#lang racket " (current-input-port))
1918 (read))
Original file line number Diff line number Diff line change 1- #lang racket
21(let ((y (ccall c_fun))) ((lambda (x) y) 11))
Original file line number Diff line number Diff line change 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 )
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)))
Original file line number Diff line number Diff line change 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])))
You can’t perform that action at this time.
0 commit comments