diff options
author | Darren Bane <darren.bane@emdalo.com> | 2020-08-04 12:30:56 +0100 |
---|---|---|
committer | Darren Bane <darren.bane@emdalo.com> | 2020-08-04 12:30:56 +0100 |
commit | 1167e1207e3c0928f04aa3ed51fc315fb5b8729a (patch) | |
tree | aa7d0bb009a5495f4ba524cfcbd4e36704c0d9eb /ceval.lisp | |
parent | 546c54613a397996e3faa04173bfa73a08a6ee47 (diff) | |
download | lsp-1167e1207e3c0928f04aa3ed51fc315fb5b8729a.tar.gz |
Flip-flop back to CL.
Diffstat (limited to 'ceval.lisp')
-rw-r--r-- | ceval.lisp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ceval.lisp b/ceval.lisp new file mode 100644 index 0000000..60a19c0 --- /dev/null +++ b/ceval.lisp @@ -0,0 +1,23 @@ +(defclass <value> () () (:abstractp t)) +(defclass <v-int> (<value>) ((int :accessor int))) +(defclass <v-str> (<value>) ((str :accessor str))) +(defclass <v-bool> (<value>) ((bool :accessor bool))) + +(defclass <environment> () ((env :accessor env))) + +(defun lookup-index (tprog num-line) + (block result-lookup-index + (for ((i 0 (+ i 1))) + ((>= i (length tprog))) + (let ((num-i (num (elt tprog i)))) + (if (= num-i num-line) + (return-from result-lookup-index i) + (if (> num-i num-line) + (return-from result-lookup-index -1))))) + -1)) + +(defun assemble (prog) + (let ((tprog (apply #'vector prog))) + (for ((i 0 (+ i 1))) + ((>= i (length tprog))) + ()))) |