ELIZA IN LISP PROJECT

The following code contains bugs. Fix the code and also expand the knowledge 
base of templates to simulate more complex interaction.

(defun match (pattern input)

(cond

((and (null pattern) (null input)))

((or (null pattern) (null input)) nil)

((or (equal (car pattern) 'ANY)(equal (car pattern)(car input)))

(match (cdr pattern) (cdr input)))

((equal (car pattern) 'MANY)

(cond

((match (cdr pattern)(cdr input))) ((match pattern (cdr input)))))

(and (listp (car pattern)) (equal (caar pattern) 'BIND))

(cond ((match (cdr pattern)(cdr input))

(setq (cadr (car pattern))(cons (car input) nil)))

((match pattern (cdr input))

(setq (cadr (car pattern)) (cons (car input)(eval (cadr (car pattern))))))))))

===============================

(defun eliza( )

(prog (input x y z)

(print (list '(hi-what bothers you today?)))

LOOP

(setq input (read))

(cond ((atom input) (print '(parentheses please)))

((equal input '(bye)) (return nil))

((equal (length input) 1)(print '(please expand more)))

((match '(MANY my (BIND x) hates me) input)

(cond ((member (car x) '(mother father sister brother))

(print '(tell me about your family)))

(t (print '(why does this bother you?)))))

((or (match '(MANY machine) input) (match '(MANY machine MANY) input))

(print '(are you intimidated by machines?)))

(t (print (list 'you 'were 'talking 'about 'your (car x)))))

(go LOOP)))