+(defmacro eval-when-compile (&body body)
+ `(eval-when (:compile-toplevel :execute)
+ ,@body))
+
+(define-compilation eval-when-compile (&rest body)
+ (eval (cons 'progn body)))
+
+;;; aritmetic primitives
+(define-compilation + (x y)
+ (concat "((" (ls-compile x env fenv) ") + (" (ls-compile y env fenv) "))"))
+
+(define-compilation - (x y)
+ (concat "((" (ls-compile x env fenv) ") - (" (ls-compile y env fenv) "))"))
+
+(define-compilation * (x y)
+ (concat "((" (ls-compile x env fenv) ") * (" (ls-compile y env fenv) "))"))
+
+(define-compilation / (x y)
+ (concat "((" (ls-compile x env fenv) ") / (" (ls-compile y env fenv) "))"))
+
+(define-compilation = (x y)
+ (concat "((" (ls-compile x env fenv) ") == (" (ls-compile y env fenv) "))"))
+
+
+(defun %compile-defvar (name)
+ (push (make-var-binding name) *env*)
+ (format nil "var ~a" (lookup-variable name *env*)))
+
+(defun %compile-defun (name)
+ (push (make-func-binding name) *fenv*)
+ (format nil "var ~a" (lookup-variable name *fenv*)))
+
+(defun compile-funcall (name args env fenv)
+ (format nil "~a(~{~a~^, ~})"
+ (lookup-function name fenv)
+ (mapcar (lambda (x) (ls-compile x env fenv)) args)))
+
+(defun ls-compile (sexp &optional env fenv)