Skip to content

Commit a46afa7

Browse files
committed
Remove string stuff from interp-heap.
1 parent ec64f6a commit a46afa7

2 files changed

Lines changed: 2 additions & 22 deletions

File tree

langs/hustle/interp-heap.rkt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#lang racket
22
(provide interp interp-env-heap)
3-
(require "heap.rkt"
4-
"env.rkt"
3+
(require "env.rkt"
54
"unload.rkt"
65
"interp-prims-heap.rkt"
76
"ast.rkt")

langs/hustle/interp-prims-heap.rkt

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#lang racket
2-
(provide interp-prim1 interp-prim2 interp-prim3)
2+
(provide interp-prim1 interp-prim2)
33
(require "heap.rkt")
44

55
;; Op1 Value* Heap -> Answer*
@@ -18,9 +18,6 @@
1818
[(list 'car (list 'cons i)) (cons h (heap-ref h i))]
1919
[(list 'cdr (list 'cons i)) (cons h (heap-ref h (add1 i)))]
2020
[(list 'empty? v) (cons h (empty? v))]
21-
[(list 'string? (list 'str s)) (cons h #t)]
22-
[(list 'string? v) (cons h #f)]
23-
[(list 'string-length (list 'str a)) (cons h (heap-ref h a))]
2421
[_ 'err]))
2522

2623
;; Op2 Value* Value* Heap -> Answer*
@@ -35,24 +32,8 @@
3532
[(list (list t1 a1) (list t2 a2)) (cons h (and (eq? t1 t2) (= a1 a2)))]
3633
[_ (cons h (eqv? v1 v2))])]
3734
[(list 'cons v1 v2) (alloc-cons v1 v2 h)]
38-
[(list 'make-string (? integer? i) (? char? c))
39-
(if (<= 0 i)
40-
(alloc-str (make-string i c) h)
41-
'err)]
42-
[(list 'string-ref (list 'str a) (? integer? i))
43-
(cons h (heap-ref h (+ a i 1)))]
4435
[_ 'err]))
4536

46-
;; Op2 Value* Value* Heap -> Answer*
47-
(define (interp-prim3 p v1 v2 v3 h)
48-
(match (list p v1 v2 v3)
49-
[(list 'string-set! (list 'str a) (? integer? i) (? char? c))
50-
(if (<= 0 v2 (sub1 (heap-ref h a)))
51-
(cons (heap-set h (+ a i 1) c)
52-
(void))
53-
'err)]
54-
[_ 'err]))
55-
5637
;; Any -> Boolean
5738
(define (codepoint? v)
5839
(and (integer? v)

0 commit comments

Comments
 (0)