;; the following tests are for the first stages of the code analysis and transformation in the compiler ;; especially for closure analysis ;; they contain an assortment of problematic cases (defparameter *tst* '(let ((x 1) (y 2)) (let ((u 3) (v 4)) (let ((p 5)) (let () (setq lp (lambda (t1 t2) (let () (setq t1 t2) (setq u t1) (setq cc t1) (setq dd u) (setq t1 ee) (setq t2 v)))) (setq x u) (setq aa x) (setq y bb) (setq lp1 (lambda (t) (setq ff t)))))))) (defparameter *tst1* '(defun f (n) (cond ((<= n 1) 1) (1 (* 2 (f (- n 1))))))) (defparameter *tst2* '(lambda (a) (defun f (n) (cond ((<= n 1) (setq x 1) (setq y b) (setq a a)) (1 (* a f (- n 1))))))) (defparameter *tst3* ' (let ((www 12)) (defun consx (x y) (let ((p (%reserve-space 8))) (set-word p 0 x) (set-word p 4 y) (tag-set p 1))) (let ((x 1)(ff nil)) (let ((i 0) (ff1 nil)) (setq ff1 (do-until ((%> i 5) ff) (let ((y 1)) (setq i (%+ i 1)) (setq ff (consx #'(lambda (z) (cond ((%= z 0) x) (1 (setq x z)))) ff))))) (%print 12) (%print ff1) (%print 33) (%print (funcall (car (cdr ff)) 22)) (%print (funcall (car ff) 0)) (%print (funcall (car (cdr (cdr ff))) 57)) (%print (funcall (car (cdr ff)) 0)))))) (defparameter *tst4* '(let ((x 1) (y 2)) (let ((u 3) (v 4)) (let ((p 5)) (let () (setq lp (lambda (t1 t2) (let () (setq t1 t2) (setq u t1) (setq cc t1) (setq dd u) (setq t1 ee) (setq t2 v)))) (setq x u) (setq aa x) (setq y bb) (setq lp1 (lambda (t) (setq ff tt)))))))) (defparameter *tst5* '(lambda (a b c) (labels ((f (m n) (progn (setq a m) (setq a c) (setq n b))) (g (r s) (progn (setq r s) (setq f s) (setq r g)))) (progn (f p q) (g a b) (setq f (lambda (t) (setq t g))))))) (defparameter *tst51* '(lambda (a b c) (labels ((f (m n) (progn (setq a m) (setq a c) (setq n b))) (g (r s) (progn (setq r #'(lambda (t) (setq a s))) (setq f s) (setq r g)))) (progn (f p q) (g a b) (setq c (lambda (t) (setq t g))))))) (defparameter *tst6* '(progn (defun h (a) (labels ((f (n) (cond ((%<= n 1) 1) (1 (%+ (f (%- n 1)) (f (%- n 2)))))) (g (n) (cond ((%<= n 1) nil) (1 (cons (f n) (g (%- n 1))))))) (g a))) (h 6))) (defparameter *tst61* '(defun h (a) (labels ((f (n) (cond ((%<= n 1) 1) (1 (%+ (f (%- n 1)) (f (%- n 2)))))) (g (k) (cond ((%<= k 1) nil) (1 (cons (f k) (g (%- k 1))))))) (g a)))) (defparameter *tst62* '(defun h (a &rest a1) (labels ((f (n &rest n1) (cond ((<= n 1) 1) (1 (+ (f (- n 1)) (f (- n 2)))))) (g (k) (cond ((<= k 1) nil) (1 (cons (f k) (g (- k 1))))))) (g a)))) (defparameter *tst7* '(defun h (a) (labels ((f (n) (cond ((<= n 1) 1) (1 (+ (foo (- n 1)) (bar (- n 2)))))) (g (n) (cond ((<= n 1) nil) (1 (cons (f n) (g (- n 1))))))) (g a))))