1 (defun ls-compile (sexp &optional env)
3 ((symbolp sexp) (format nil "V_~a" sexp))
4 ((integerp sexp) (format nil " ~a " sexp))
5 ((stringp sexp) (format nil " \"~a\" " sexp))
8 (if (format nil "((~a)? (~a) : (~a))"
9 (ls-compile (second sexp))
10 (ls-compile (third sexp))
11 (ls-compile (fourth sexp))))
12 (lambda (concat "(function ("
13 (format nil "~{V_~a~^, ~}" (second sexp))
15 (ls-compile-block (cddr sexp) env)
17 ")) ; (function (params) { body })
20 ;;; simplify me, please
21 (defun concat (&rest strs)
22 (reduce (lambda (s1 s2) (concatenate 'string s1 s2))
26 (defun ls-compile-block (sexps env)
28 "~{~#[~; return ~a;~:;~a;~%~]~}"
33 (defparameter *env* '())
36 (defparameter *env-fun* '())