- (let ((compiler-func (second (assoc (car sexp) *compilations*))))
- (if compiler-func
- (apply compiler-func env fenv (cdr sexp))
- (compile-funcall (car sexp) (cdr sexp) env fenv))))))
+ (let ((sexp (ls-macroexpand-1 sexp env fenv)))
+ (let ((compiler-func (second (assoc (car sexp) *compilations*))))
+ (if compiler-func
+ (apply compiler-func env fenv (cdr sexp))
+ (compile-funcall (car sexp) (cdr sexp) env fenv)))))))
+
+
+(defun ls-compile-file (filename output)
+ (with-open-file (in filename)
+ (with-open-file (out output :direction :output :if-exists :supersede)
+ (loop
+ for x = (read in nil) while x
+ for compilation = (ls-compile x)
+ when compilation do (write-line (concat compilation "; ") out)))))