-
Notifications
You must be signed in to change notification settings - Fork 0
/
snippet.scm
62 lines (58 loc) · 1.62 KB
/
snippet.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
(import (silly-k))
(define (debug-passes s)
(display "> ")
(display s)
(newline)
(fold-left (lambda (acc p)
(let* ([pass (car p)]
[unparser (cdr p)]
[expr (cond
[(null? acc) (list pass)]
[else (list pass acc)])])
(pretty-print ((eval unparser) (with-input-from-string s (lambda () (eval expr)))))
expr))
'()
passes)
(newline))
;;(debug-passes "foo")
;;(debug-passes "foo bar")
;(debug-passes "1")
;(debug-passes "1 2 3")
;;(debug-passes "{w}")
;;(debug-passes "{a}")
;(debug-passes "{1-w}2")
;(debug-passes "{1+w}2 3 4")
;(debug-passes "{1+w}'1 2 3")
;(debug-passes "{1-w}'1 2 3")
;;(debug-passes "{x w w}")
;;(debug-passes "{w+{w}}2")
;(debug-passes "1+1 2 3")
;(debug-passes "1 2+3 4")
;(debug-passes "1 2 3+1")
;(debug-passes "1{a+w}2")
;(debug-passes "1{a+w}2 3 4")
;(debug-passes "1-2")
;(debug-passes "1+2")
;(debug-passes "1+2+3+4")
;(debug-passes "1+2-3+4")
;(debug-passes "(1:)+0:")
;(debug-passes "(0:)+0:")
;(debug-passes "](-2)")
;(debug-passes "2-3")
;(debug-passes "]1 2 3")
;(debug-passes "](+/1 2 3)")
;(debug-passes "]@+/1 2 3")
;(debug-passes "1=2")
;(debug-passes "{1=2;w;1 4}")
;(debug-passes "{w=2;w;w=a;1;1}")
;(debug-passes "{w=2;w;]w}")
;(debug-passes "(1=2;0 7;1 4)")
;(debug-passes "(1=2;5;]5)")
;(debug-passes "]{w=1;w+1;w=2;w+2;w+3}1")
;(debug-passes "{w=0;0;1+_f(w-1)}")
;(debug-passes "x+x:7")
;(debug-passes "(x:8)+x:7")
;(debug-passes "x+(x:7)+1")
;(debug-passes "1+(2=2)")
(debug-passes "2{a+w}'3 4 5")
(debug-passes "(1=1)+(2=2)")