Init
This commit is contained in:
1
cs420-acc/l3-warmup/tests/bignums.in
Normal file
1
cs420-acc/l3-warmup/tests/bignums.in
Normal file
@@ -0,0 +1 @@
|
||||
100
|
1
cs420-acc/l3-warmup/tests/bignums.out
Normal file
1
cs420-acc/l3-warmup/tests/bignums.out
Normal file
@@ -0,0 +1 @@
|
||||
Factorial of? 100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
|
14
cs420-acc/l3-warmup/tests/expr-and.l3
Normal file
14
cs420-acc/l3-warmup/tests/expr-and.l3
Normal file
@@ -0,0 +1,14 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "and" expression
|
||||
|
||||
(@byte-write 71)
|
||||
|
||||
(and (@byte-write 65) #u)
|
||||
(and #t (@byte-write 66))
|
||||
(and #f (@byte-write 63))
|
||||
(and (@byte-write 67) #f (@byte-write 63))
|
||||
(@byte-write (and 63 68))
|
||||
(@byte-write (and #t 69))
|
||||
(@byte-write (and #t 'a' 70))
|
||||
(@byte-write (and "a" #u 63 71))
|
16
cs420-acc/l3-warmup/tests/expr-begin.l3
Normal file
16
cs420-acc/l3-warmup/tests/expr-begin.l3
Normal file
@@ -0,0 +1,16 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "begin" expression
|
||||
|
||||
(@byte-write 67)
|
||||
|
||||
(begin
|
||||
(@byte-write 65)
|
||||
(@byte-write 66))
|
||||
|
||||
(let ((b (@block-alloc-0 2)))
|
||||
(@byte-write
|
||||
(begin
|
||||
(@block-set! b 0 60)
|
||||
(@block-set! b 1 7)
|
||||
(@+ (@block-get b 0) (@block-get b 1)))))
|
18
cs420-acc/l3-warmup/tests/expr-cond.l3
Normal file
18
cs420-acc/l3-warmup/tests/expr-cond.l3
Normal file
@@ -0,0 +1,18 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "cond" expression
|
||||
|
||||
(@byte-write 68)
|
||||
|
||||
(cond (#t (@byte-write 65))
|
||||
(#t (@byte-write 63)))
|
||||
|
||||
(cond (#f (@byte-write 63))
|
||||
(#f (@byte-write 63))
|
||||
(#t (@byte-write 66)))
|
||||
|
||||
(@byte-write (cond (#f 63)
|
||||
(67 67)
|
||||
(#t 63)))
|
||||
|
||||
(cond ((@= #u (cond (#f 12))) (@byte-write 68)))
|
32
cs420-acc/l3-warmup/tests/expr-fun.l3
Normal file
32
cs420-acc/l3-warmup/tests/expr-fun.l3
Normal file
@@ -0,0 +1,32 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "fun" expression
|
||||
|
||||
(@byte-write 73)
|
||||
|
||||
((fun (b) (@byte-write b)) 65)
|
||||
((fun (b)
|
||||
(@byte-write b)
|
||||
(@byte-write (@+ b 1)))
|
||||
66)
|
||||
(@byte-write ((fun (x) x) 68))
|
||||
|
||||
(let ((compose (fun (f g)
|
||||
(fun (x) (f (g x)))))
|
||||
(succ (fun (x) (@+ x 1)))
|
||||
(twice (fun (x) (@+ x x))))
|
||||
(@byte-write ((compose succ twice) 34)))
|
||||
|
||||
((fun (x y z) #u)
|
||||
(@byte-write 70)
|
||||
(@byte-write 71)
|
||||
(@byte-write 72))
|
||||
|
||||
(let* ((fact (fun (self x)
|
||||
(if (@= 0 x)
|
||||
1
|
||||
(@* x (self self (@- x 1))))))
|
||||
(fix (fun (f x)
|
||||
(f f x))))
|
||||
(if (@= (fix fact 5) 120)
|
||||
(@byte-write 73)))
|
18
cs420-acc/l3-warmup/tests/expr-if.l3
Normal file
18
cs420-acc/l3-warmup/tests/expr-if.l3
Normal file
@@ -0,0 +1,18 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "if" expression
|
||||
|
||||
(@byte-write 71)
|
||||
|
||||
(if (@byte-write 65) 1 2)
|
||||
(@byte-write (if #t 66 63))
|
||||
(@byte-write (if #f 63 67))
|
||||
(if #t (@byte-write 68) (@byte-write 63))
|
||||
(if #f (@byte-write 63) (@byte-write 69))
|
||||
(if (@= #u (if #f 15))
|
||||
(@byte-write 70))
|
||||
|
||||
;; The condition has a side effect, and should therefore not be optimized away.
|
||||
;; This expression is made to enter tail mode in CL3ToCPSTranslator, where we
|
||||
;; want to check that it isn't optimized away
|
||||
(let ((a 71)) (if (if (@byte-write 71) #t #t) 1 2))
|
18
cs420-acc/l3-warmup/tests/expr-let.l3
Normal file
18
cs420-acc/l3-warmup/tests/expr-let.l3
Normal file
@@ -0,0 +1,18 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "let" expression
|
||||
|
||||
(@byte-write 69)
|
||||
|
||||
(let ((A 65))
|
||||
(@byte-write A))
|
||||
(let ((B 63))
|
||||
(let ((B (@+ B 3)))
|
||||
(@byte-write B)))
|
||||
(let ((C 67))
|
||||
(@byte-write C)
|
||||
(@byte-write (@+ C 1)))
|
||||
(@byte-write
|
||||
(let ((E 69))
|
||||
63
|
||||
E))
|
13
cs420-acc/l3-warmup/tests/expr-letrec.l3
Normal file
13
cs420-acc/l3-warmup/tests/expr-letrec.l3
Normal file
@@ -0,0 +1,13 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "letrec" expression
|
||||
|
||||
(@byte-write 66)
|
||||
|
||||
(letrec ((fact (fun (x) (if (@= 0 x) 1 (@* x (fact (@- x 1)))))))
|
||||
(@byte-write (@- (fact 5) 55)))
|
||||
(letrec ((even? (fun (x) (if (@= x 0) #t (odd? (@- x 1)))))
|
||||
(odd? (fun (x) (if (@= x 0) #f (even? (@- x 1))))))
|
||||
(if (even? 66)
|
||||
(@byte-write 66)
|
||||
(@byte-write 63)))
|
18
cs420-acc/l3-warmup/tests/expr-lets.l3
Normal file
18
cs420-acc/l3-warmup/tests/expr-lets.l3
Normal file
@@ -0,0 +1,18 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "let*" expression
|
||||
|
||||
(@byte-write 69)
|
||||
|
||||
(let* ((A 65))
|
||||
(@byte-write A))
|
||||
(let* ((B 63)
|
||||
(B (@+ B 3)))
|
||||
(@byte-write B))
|
||||
(let* ((C 67))
|
||||
(@byte-write C)
|
||||
(@byte-write (@+ C 1)))
|
||||
(@byte-write
|
||||
(let* ((E 69))
|
||||
63
|
||||
E))
|
9
cs420-acc/l3-warmup/tests/expr-not.l3
Normal file
9
cs420-acc/l3-warmup/tests/expr-not.l3
Normal file
@@ -0,0 +1,9 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "not" expression
|
||||
|
||||
(@byte-write 67)
|
||||
|
||||
(@byte-write (if (@= #t (not #f)) 65 63))
|
||||
(@byte-write (if (@= #f (not #t)) 66 63))
|
||||
(@byte-write (if (@= #f (not 42)) 67 63))
|
13
cs420-acc/l3-warmup/tests/expr-or.l3
Normal file
13
cs420-acc/l3-warmup/tests/expr-or.l3
Normal file
@@ -0,0 +1,13 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "or" expression
|
||||
|
||||
(@byte-write 70)
|
||||
|
||||
(or (@byte-write 65) #u)
|
||||
(or #f (@byte-write 66))
|
||||
(or #t (@byte-write 63))
|
||||
(or (@byte-write 67) #t (@byte-write 63))
|
||||
(@byte-write (or 68 63))
|
||||
(@byte-write (or #f 69))
|
||||
(@byte-write (or #f #f 70))
|
10
cs420-acc/l3-warmup/tests/expr-rec.l3
Normal file
10
cs420-acc/l3-warmup/tests/expr-rec.l3
Normal file
@@ -0,0 +1,10 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "rec" expression
|
||||
|
||||
(@byte-write 65)
|
||||
|
||||
(rec loop ((i 0) (j 65))
|
||||
(if (@= j 0)
|
||||
(@byte-write i)
|
||||
(loop (@+ i 1) (@- j 1))))
|
12
cs420-acc/l3-warmup/tests/int-print.l3
Normal file
12
cs420-acc/l3-warmup/tests/int-print.l3
Normal file
@@ -0,0 +1,12 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
(int-print 2018)
|
||||
(@byte-write 10) ;newline
|
||||
(int-print -2018)
|
||||
(@byte-write 10) ;newline
|
||||
(int-print 0)
|
||||
(@byte-write 10) ;newline
|
||||
(int-print 1073741823)
|
||||
(@byte-write 10) ;newline
|
||||
(int-print -1073741824)
|
||||
(@byte-write 10) ;newline
|
2
cs420-acc/l3-warmup/tests/int-print.l3m
Normal file
2
cs420-acc/l3-warmup/tests/int-print.l3m
Normal file
@@ -0,0 +1,2 @@
|
||||
../library/integers.l3m
|
||||
int-print.l3
|
5
cs420-acc/l3-warmup/tests/int-print.out
Normal file
5
cs420-acc/l3-warmup/tests/int-print.out
Normal file
@@ -0,0 +1,5 @@
|
||||
2018
|
||||
-2018
|
||||
0
|
||||
1073741823
|
||||
-1073741824
|
2
cs420-acc/l3-warmup/tests/maze.in
Normal file
2
cs420-acc/l3-warmup/tests/maze.in
Normal file
@@ -0,0 +1,2 @@
|
||||
8
|
||||
1337
|
17
cs420-acc/l3-warmup/tests/maze.out
Normal file
17
cs420-acc/l3-warmup/tests/maze.out
Normal file
@@ -0,0 +1,17 @@
|
||||
Size: Seed: XXXXXXXXXXXXXXXXX
|
||||
X X X X X X
|
||||
X X X X X XXX X X
|
||||
X X X X X
|
||||
X XXXXX X XXXXXXX
|
||||
X X X X
|
||||
XXXXXXX X X XXXXX
|
||||
X X X X X
|
||||
XXX X X X X XXX X
|
||||
X X X X X
|
||||
XXX X X XXXXXXX X
|
||||
X X X X X X
|
||||
X XXXXXXX X X X X
|
||||
X X X X X X
|
||||
XXX XXXXX X X X X
|
||||
X X X X X
|
||||
XXXXXXXXXXXXXXXXX
|
12
cs420-acc/l3-warmup/tests/prim-add.l3
Normal file
12
cs420-acc/l3-warmup/tests/prim-add.l3
Normal file
@@ -0,0 +1,12 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @+ primitive
|
||||
|
||||
(@byte-write 70)
|
||||
|
||||
(@byte-write (@+ 65 0)) ;A
|
||||
(@byte-write (@+ 0 66)) ;B
|
||||
(@byte-write (@+ 68 -1)) ;C
|
||||
(@byte-write (@+ -1 69)) ;D
|
||||
(@byte-write (@+ 1073741823 70)) ;E
|
||||
(@byte-write (@+ 71 1073741823)) ;F
|
12
cs420-acc/l3-warmup/tests/prim-and.l3
Normal file
12
cs420-acc/l3-warmup/tests/prim-and.l3
Normal file
@@ -0,0 +1,12 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @and primitive
|
||||
|
||||
(@byte-write 69)
|
||||
|
||||
(@byte-write (@and #x7FFFFFFF 65)) ;A
|
||||
(@byte-write (@and 66 #x7FFFFFF)) ;B
|
||||
(@byte-write (@and 67 -1)) ;C
|
||||
(@byte-write (@and -1 68)) ;D
|
||||
(@byte-write (@and 69 237)) ;E
|
||||
|
8
cs420-acc/l3-warmup/tests/prim-block-alloc.l3
Normal file
8
cs420-acc/l3-warmup/tests/prim-block-alloc.l3
Normal file
@@ -0,0 +1,8 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @block-alloc-0? primitive
|
||||
|
||||
(@byte-write 66)
|
||||
|
||||
(@byte-write (if (@= (@block-alloc-0 0) (@block-alloc-0 0)) 63 65)) ;A
|
||||
(@byte-write (if (not (@= (@block-alloc-0 0) (@block-alloc-0 0))) 66 63)) ;B
|
15
cs420-acc/l3-warmup/tests/prim-block-get-set.l3
Normal file
15
cs420-acc/l3-warmup/tests/prim-block-get-set.l3
Normal file
@@ -0,0 +1,15 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @block-get and @block-set! primitives
|
||||
|
||||
(@byte-write 68)
|
||||
|
||||
(let ((b (@block-alloc-0 4)))
|
||||
(@block-set! b 0 'a')
|
||||
(@block-set! b 1 'b')
|
||||
(@block-set! b 2 'c')
|
||||
(@block-set! b 3 'd')
|
||||
(@byte-write (if (@= (@block-get b 0) 'a') 65 63))
|
||||
(@byte-write (if (@= (@block-get b 1) 'b') 66 63))
|
||||
(@byte-write (if (@= (@block-get b 2) 'c') 67 63))
|
||||
(@byte-write (if (@= (@block-get b 3) 'd') 68 63)))
|
8
cs420-acc/l3-warmup/tests/prim-block-length.l3
Normal file
8
cs420-acc/l3-warmup/tests/prim-block-length.l3
Normal file
@@ -0,0 +1,8 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @block-length primitive
|
||||
|
||||
(@byte-write 66)
|
||||
|
||||
(@byte-write (@block-length (@block-alloc-0 65))) ;A
|
||||
(@byte-write (@block-length (@block-alloc-1 66))) ;B
|
8
cs420-acc/l3-warmup/tests/prim-block-tag.l3
Normal file
8
cs420-acc/l3-warmup/tests/prim-block-tag.l3
Normal file
@@ -0,0 +1,8 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @block-tag primitive
|
||||
|
||||
(@byte-write 66)
|
||||
|
||||
(@byte-write (@block-tag (@block-alloc-65 0))) ;A
|
||||
(@byte-write (@block-tag (@block-alloc-66 1))) ;B
|
15
cs420-acc/l3-warmup/tests/prim-blockp.l3
Normal file
15
cs420-acc/l3-warmup/tests/prim-blockp.l3
Normal file
@@ -0,0 +1,15 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @block? primitive
|
||||
|
||||
(@byte-write 72)
|
||||
|
||||
(@byte-write (if (@block? 1) 63 65)) ;A
|
||||
(@byte-write (if (@block? #t) 63 66)) ;B
|
||||
(@byte-write (if (@block? #f) 63 67)) ;C
|
||||
(@byte-write (if (@block? #u) 63 68)) ;D
|
||||
(@byte-write (if (@block? 'A') 63 69)) ;E
|
||||
|
||||
(@byte-write (if (@block? (@block-alloc-0 0)) 70 63)) ;F
|
||||
(@byte-write (if (@block? "") 71 63)) ;G
|
||||
(@byte-write (if (@block? (fun () 1)) 72 63)) ;H
|
11
cs420-acc/l3-warmup/tests/prim-boolp.l3
Normal file
11
cs420-acc/l3-warmup/tests/prim-boolp.l3
Normal file
@@ -0,0 +1,11 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @bool? primitive
|
||||
|
||||
(@byte-write 69)
|
||||
|
||||
(@byte-write (if (@bool? #t) 65 63)) ;A
|
||||
(@byte-write (if (@bool? #f) 66 63)) ;B
|
||||
(@byte-write (if (@bool? 1) 63 67)) ;C
|
||||
(@byte-write (if (@bool? "1") 63 68)) ;D
|
||||
(@byte-write (if (@bool? #u) 63 69)) ;E
|
8
cs420-acc/l3-warmup/tests/prim-char-to-int.l3
Normal file
8
cs420-acc/l3-warmup/tests/prim-char-to-int.l3
Normal file
@@ -0,0 +1,8 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @char->int primitive
|
||||
|
||||
(@byte-write 66)
|
||||
|
||||
(@byte-write (@char->int 'A')) ;A
|
||||
(@byte-write (if (@= (@char->int '€') 8364) 66 63)) ;B
|
14
cs420-acc/l3-warmup/tests/prim-charp.l3
Normal file
14
cs420-acc/l3-warmup/tests/prim-charp.l3
Normal file
@@ -0,0 +1,14 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @char? primitive
|
||||
|
||||
(@byte-write 72)
|
||||
|
||||
(@byte-write (if (@char? 'A') 65 63)) ;A
|
||||
(@byte-write (if (@char? '€') 66 63)) ;B
|
||||
(@byte-write (if (@char? ' ') 67 63)) ;C
|
||||
(@byte-write (if (@char? 1) 63 68)) ;D
|
||||
(@byte-write (if (@char? "1") 63 69)) ;E
|
||||
(@byte-write (if (@char? #t) 63 70)) ;F
|
||||
(@byte-write (if (@char? #f) 63 71)) ;G
|
||||
(@byte-write (if (@char? #u) 63 72)) ;H
|
15
cs420-acc/l3-warmup/tests/prim-div.l3
Normal file
15
cs420-acc/l3-warmup/tests/prim-div.l3
Normal file
@@ -0,0 +1,15 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @/ primitive
|
||||
|
||||
(@byte-write 73)
|
||||
|
||||
(@byte-write (@/ 65 1)) ;A
|
||||
(@byte-write (@/ 132 2)) ;B
|
||||
(@byte-write (@/ -201 -3)) ;C
|
||||
(@byte-write (if (@= (@/ 15 4) 3) 68 63)) ;D
|
||||
(@byte-write (if (@= (@/ 15 -4) -3) 69 63)) ;E
|
||||
(@byte-write (if (@= (@/ -15 4) -3) 70 63)) ;F
|
||||
(@byte-write (if (@= (@/ -15 -4) 3) 71 63)) ;G
|
||||
(@byte-write (if (@= (@/ -1073741824 -1) -1073741824) 72 63)) ;H
|
||||
(@byte-write (if (@= (@/ 1073741823 1073741823) 1) 73 63)) ;I
|
19
cs420-acc/l3-warmup/tests/prim-eq.l3
Normal file
19
cs420-acc/l3-warmup/tests/prim-eq.l3
Normal file
@@ -0,0 +1,19 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @= primitive
|
||||
|
||||
(@byte-write 76)
|
||||
|
||||
(@byte-write (if (@= #t #t) 65 63)) ;A
|
||||
(@byte-write (if (@= #f #f) 66 63)) ;B
|
||||
(@byte-write (if (@= 2018 2018) 67 63)) ;C
|
||||
(@byte-write (if (@= 'A' 'A') 68 63)) ;D
|
||||
(let ((s "bla")) (@byte-write (if (@= s s) 69 63))) ;E
|
||||
(let ((f (fun () 1))) (@byte-write (if (@= f f) 70 63))) ;F
|
||||
|
||||
(@byte-write (if (@= #t #f) 63 71)) ;G
|
||||
(@byte-write (if (@= #t #u) 63 72)) ;H
|
||||
(@byte-write (if (@= 2018 2017) 63 73)) ;I
|
||||
(@byte-write (if (@= 'A' 65) 63 74)) ;J
|
||||
(@byte-write (if (@= "bla" "bla") 63 75)) ;K
|
||||
(@byte-write (if (@= (fun () 1) (fun () 1)) 63 76)) ;L
|
9
cs420-acc/l3-warmup/tests/prim-int-to-char.l3
Normal file
9
cs420-acc/l3-warmup/tests/prim-int-to-char.l3
Normal file
@@ -0,0 +1,9 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @int->char primitive
|
||||
|
||||
(@byte-write 66)
|
||||
|
||||
(@byte-write (if (@= (@int->char 65) 'A') 65 63)) ;A
|
||||
(@byte-write (if (@= (@int->char 8364) '€') 66 63)) ;B
|
||||
|
14
cs420-acc/l3-warmup/tests/prim-intp.l3
Normal file
14
cs420-acc/l3-warmup/tests/prim-intp.l3
Normal file
@@ -0,0 +1,14 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @int? primitive
|
||||
|
||||
(@byte-write 72)
|
||||
|
||||
(@byte-write (if (@int? 0) 65 63)) ;A
|
||||
(@byte-write (if (@int? 1073741823) 66 63)) ;B
|
||||
(@byte-write (if (@int? -1073741824) 67 63)) ;C
|
||||
(@byte-write (if (@int? '1') 63 68)) ;D
|
||||
(@byte-write (if (@int? "1") 63 69)) ;E
|
||||
(@byte-write (if (@int? #t) 63 70)) ;F
|
||||
(@byte-write (if (@int? #f) 63 71)) ;G
|
||||
(@byte-write (if (@int? #u) 63 72)) ;H
|
13
cs420-acc/l3-warmup/tests/prim-le.l3
Normal file
13
cs420-acc/l3-warmup/tests/prim-le.l3
Normal file
@@ -0,0 +1,13 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @<= primitive
|
||||
|
||||
(@byte-write 71)
|
||||
|
||||
(@byte-write (if (@<= -1073741824 1073741823) 65 63)) ;A
|
||||
(@byte-write (if (@<= 1073741823 -1073741824) 63 66)) ;B
|
||||
(@byte-write (if (@<= 0 1) 67 63)) ;C
|
||||
(@byte-write (if (@<= 1 0) 63 68)) ;D
|
||||
(@byte-write (if (@<= 2018 2018) 69 63)) ;E
|
||||
(@byte-write (if (@<= 2017 2018) 70 63)) ;F
|
||||
(@byte-write (if (@<= -2018 -2017) 71 63)) ;G
|
13
cs420-acc/l3-warmup/tests/prim-lt.l3
Normal file
13
cs420-acc/l3-warmup/tests/prim-lt.l3
Normal file
@@ -0,0 +1,13 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @< primitive
|
||||
|
||||
(@byte-write 71)
|
||||
|
||||
(@byte-write (if (@< -1073741824 1073741823) 65 63)) ;A
|
||||
(@byte-write (if (@< 1073741823 -1073741824) 63 66)) ;B
|
||||
(@byte-write (if (@< 0 1) 67 63)) ;C
|
||||
(@byte-write (if (@< 1 0) 63 68)) ;D
|
||||
(@byte-write (if (@< 2018 2018) 63 69)) ;E
|
||||
(@byte-write (if (@< 2017 2018) 70 63)) ;F
|
||||
(@byte-write (if (@< -2018 -2017) 71 63)) ;G
|
14
cs420-acc/l3-warmup/tests/prim-mod.l3
Normal file
14
cs420-acc/l3-warmup/tests/prim-mod.l3
Normal file
@@ -0,0 +1,14 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @% primitive
|
||||
|
||||
(@byte-write 72)
|
||||
|
||||
(@byte-write (@% 65 66)) ;A
|
||||
(@byte-write (@% 133 67)) ;B
|
||||
(@byte-write (if (@= (@% 15 4) 3) 67 63)) ;C
|
||||
(@byte-write (if (@= (@% 15 -4) 3) 68 63)) ;D
|
||||
(@byte-write (if (@= (@% -15 4) -3) 69 63)) ;E
|
||||
(@byte-write (if (@= (@% -15 -4) -3) 70 63)) ;F
|
||||
(@byte-write (if (@= (@% -1073741824 1) 0) 71 63)) ;G
|
||||
(@byte-write (if (@= (@% 1073741823 2) 1) 72 63)) ;H
|
12
cs420-acc/l3-warmup/tests/prim-mul.l3
Normal file
12
cs420-acc/l3-warmup/tests/prim-mul.l3
Normal file
@@ -0,0 +1,12 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @* primitive
|
||||
|
||||
(@byte-write 70)
|
||||
|
||||
(@byte-write (@* 65 1)) ;A
|
||||
(@byte-write (@* -1 -66)) ;B
|
||||
(@byte-write (@* -67 -1)) ;C
|
||||
(@byte-write (@* -2 -34)) ;D
|
||||
(@byte-write (if (@= (@* 1073741823 2) -2) 69 63)) ;E
|
||||
(@byte-write (if (@= (@* -1073741822 17) -1073741790) 70 63)) ;F
|
12
cs420-acc/l3-warmup/tests/prim-or.l3
Normal file
12
cs420-acc/l3-warmup/tests/prim-or.l3
Normal file
@@ -0,0 +1,12 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @or primitive
|
||||
|
||||
(@byte-write 69)
|
||||
|
||||
(@byte-write (@or 0 65)) ;A
|
||||
(@byte-write (@or 66 0)) ;B
|
||||
(@byte-write (@or 66 1)) ;C
|
||||
(@byte-write (if (@= (@or -1 68) -1) 68 63)) ;D
|
||||
(@byte-write (@or 68 65)) ;E
|
||||
|
9
cs420-acc/l3-warmup/tests/prim-shift-left.l3
Normal file
9
cs420-acc/l3-warmup/tests/prim-shift-left.l3
Normal file
@@ -0,0 +1,9 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @shift-left primitive
|
||||
|
||||
(@byte-write 67)
|
||||
|
||||
(@byte-write (@shift-left 65 0)) ;A
|
||||
(@byte-write (@shift-left 33 1)) ;B
|
||||
(@byte-write (if (@= (@shift-left #x20000000 2) 0) 67 63)) ;C
|
9
cs420-acc/l3-warmup/tests/prim-shift-right.l3
Normal file
9
cs420-acc/l3-warmup/tests/prim-shift-right.l3
Normal file
@@ -0,0 +1,9 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @shift-right primitive
|
||||
|
||||
(@byte-write 67)
|
||||
|
||||
(@byte-write (@shift-right 65 0)) ;A
|
||||
(@byte-write (@shift-right 132 1)) ;B
|
||||
(@byte-write (if (@= (@shift-right #x40000000 1) #x60000000) 67 63)) ;C
|
12
cs420-acc/l3-warmup/tests/prim-sub.l3
Normal file
12
cs420-acc/l3-warmup/tests/prim-sub.l3
Normal file
@@ -0,0 +1,12 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @- primitive
|
||||
|
||||
(@byte-write 70)
|
||||
|
||||
(@byte-write (@- 65 0)) ;A
|
||||
(@byte-write (@- 0 -66)) ;B
|
||||
(@byte-write (@- 66 -1)) ;C
|
||||
(@byte-write (@- -1 -69)) ;D
|
||||
(@byte-write (@- -1073741824 1073741755)) ;E
|
||||
(@byte-write (@- -1073741754 -1073741824)) ;F
|
11
cs420-acc/l3-warmup/tests/prim-unitp.l3
Normal file
11
cs420-acc/l3-warmup/tests/prim-unitp.l3
Normal file
@@ -0,0 +1,11 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @unit? primitive
|
||||
|
||||
(@byte-write 69)
|
||||
|
||||
(@byte-write (if (@unit? #u) 65 63)) ;A
|
||||
(@byte-write (if (@unit? #t) 63 66)) ;B
|
||||
(@byte-write (if (@unit? #f) 63 67)) ;C
|
||||
(@byte-write (if (@unit? 1) 67 68)) ;D
|
||||
(@byte-write (if (@unit? "1") 68 69)) ;E
|
13
cs420-acc/l3-warmup/tests/prim-xor.l3
Normal file
13
cs420-acc/l3-warmup/tests/prim-xor.l3
Normal file
@@ -0,0 +1,13 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the @xor primitive
|
||||
|
||||
(@byte-write 70)
|
||||
|
||||
(@byte-write (@xor 0 65)) ;A
|
||||
(@byte-write (@xor 66 0)) ;B
|
||||
(@byte-write (@xor 66 1)) ;C
|
||||
(@byte-write (@xor -1 -69)) ;D
|
||||
(@byte-write (if (@= (@xor 2018 2018) 0) 69 63)) ;E
|
||||
(@byte-write (@xor 207 137)) ;F
|
||||
|
2
cs420-acc/l3-warmup/tests/queens.in
Normal file
2
cs420-acc/l3-warmup/tests/queens.in
Normal file
@@ -0,0 +1,2 @@
|
||||
6
|
||||
0
|
12
cs420-acc/l3-warmup/tests/queens.out
Normal file
12
cs420-acc/l3-warmup/tests/queens.out
Normal file
@@ -0,0 +1,12 @@
|
||||
enter size (0 to exit)>
|
||||
6-queen(s)
|
||||
list: (5 3 1 6 4 2 )
|
||||
_ _ _ _ _ _
|
||||
| |o| | | | |
|
||||
| | | |o| | |
|
||||
| | | | | |o|
|
||||
|o| | | | | |
|
||||
| | |o| | | |
|
||||
| | | | |o| |
|
||||
|
||||
enter size (0 to exit)>
|
14
cs420-acc/l3-warmup/tests/stmt-def.l3
Normal file
14
cs420-acc/l3-warmup/tests/stmt-def.l3
Normal file
@@ -0,0 +1,14 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "def" statement
|
||||
|
||||
(@byte-write 67)
|
||||
|
||||
(def A 65)
|
||||
(@byte-write A)
|
||||
|
||||
(def B (begin 63 66))
|
||||
(@byte-write B)
|
||||
|
||||
(def A 67)
|
||||
(@byte-write A)
|
14
cs420-acc/l3-warmup/tests/stmt-defrec.l3
Normal file
14
cs420-acc/l3-warmup/tests/stmt-defrec.l3
Normal file
@@ -0,0 +1,14 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "defrec" statement
|
||||
|
||||
(@byte-write 67)
|
||||
|
||||
(defrec succ (fun (x) (@+ x 1)))
|
||||
(@byte-write (succ 64))
|
||||
|
||||
(defrec fact (fun (x) (if (@= x 0) 1 (@* x (fact (@- x 1))))))
|
||||
(@byte-write (@- (fact 5) 54))
|
||||
|
||||
(defrec fact (fun (x) (@+ x 2)))
|
||||
(@byte-write (fact 65))
|
15
cs420-acc/l3-warmup/tests/stmt-halt.l3
Normal file
15
cs420-acc/l3-warmup/tests/stmt-halt.l3
Normal file
@@ -0,0 +1,15 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "halt" statement
|
||||
|
||||
(@byte-write 66)
|
||||
|
||||
(halt (begin
|
||||
(@byte-write 65)
|
||||
(halt (begin
|
||||
(@byte-write 66)
|
||||
0))
|
||||
(@byte-write 63)
|
||||
1))
|
||||
|
||||
(@byte-write 63)
|
3
cs420-acc/l3-warmup/tests/unimaze.in
Normal file
3
cs420-acc/l3-warmup/tests/unimaze.in
Normal file
@@ -0,0 +1,3 @@
|
||||
20
|
||||
8
|
||||
2018
|
7
cs420-acc/l3-warmup/tests/unimaze.out
Normal file
7
cs420-acc/l3-warmup/tests/unimaze.out
Normal file
@@ -0,0 +1,7 @@
|
||||
Maze width: Maze height: Random seed: ┌────┬┬──┬┬─┬─┬─┬─┐
|
||||
│╷╷╷╷╵│╷╶┤│╷╵╶┼┐└╴│
|
||||
│├┤└┤╷└┤╷╵││┌─┘└─╴│
|
||||
├┘└╴└┴┬┴┘╷╵└┘┌╴┌╴╷│
|
||||
│╷┌╴╶┐└┬╴├┬─╴├─┤┌┘│
|
||||
│└┤╷┌┘╷╵╷│╵╶┐├╴└┴╴│
|
||||
└─┴┴┴─┴─┴┴──┴┴────┘
|
Reference in New Issue
Block a user