Skip to content

Commit b75b81f

Browse files
committed
Cleaning up Knock.
1 parent 2f1be23 commit b75b81f

4 files changed

Lines changed: 4 additions & 16 deletions

File tree

langs/knock/ast.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
;; | 'vector? | vector-length
3434
;; | 'string? | string-length
3535
;; type Op2 = '+ | '- | '< | '=
36-
;; | 'cons
36+
;; | 'cons | 'eq?
3737
;; | 'make-vector | 'vector-ref
3838
;; | 'make-string | 'string-ref
3939
;; type Op3 = 'vector-set!

langs/knock/interp.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[(Eof) eof]
3737
[(Empty) '()]
3838
[(Var x) (lookup r x)]
39-
[(Str s) (string-copy s)]
39+
[(Str s) s]
4040
[(Prim0 'void) (void)]
4141
[(Prim0 'read-byte) (read-byte)]
4242
[(Prim0 'peek-byte) (peek-byte)]

langs/knock/parse.rkt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@
7272
[(list 'cons p1 p2)
7373
(PCons (parse-pat p1) (parse-pat p2))]
7474
[(list 'and p1 p2)
75-
(PAnd (parse-pat p1) (parse-pat p2))]
76-
[(list 'list)
77-
(PLit '())]
78-
[(cons 'list (cons p ps))
79-
(PCons (parse-pat p) (parse-pat (cons 'list ps)))]))
75+
(PAnd (parse-pat p1) (parse-pat p2))]))
8076

8177
(define op0
8278
'(read-byte peek-byte void))

langs/knock/test/test-runner.rkt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,7 @@
231231
(check-equal? (run '(match (box 1) [(box 2) 0] [_ 1]))
232232
1)
233233
(check-equal? (run '(match (box 1) [(box x) x] [_ 2]))
234-
1)
235-
(check-equal? (run '(match '() [(list) 1] [_ 2]))
236-
1)
237-
(check-equal? (run '(match '() [(list 1) 1] [_ 2]))
238-
2)
239-
(check-equal? (run '(match (cons 1 '()) [(list 1) 1] [_ 2]))
240-
1)
241-
(check-equal? (run '(match (cons 1 (cons 2 (cons 3 '()))) [(list x y z) z] [_ 2]))
242-
3))
234+
1))
243235

244236
(define (test-runner-io run)
245237
;; Evildoer examples

0 commit comments

Comments
 (0)