about summary refs log tree commit diff stats
path: root/ceval.lisp
diff options
context:
space:
mode:
authorDarren Bane <darren.bane@emdalo.com>2020-08-04 12:30:56 +0100
committerDarren Bane <darren.bane@emdalo.com>2020-08-04 12:30:56 +0100
commit1167e1207e3c0928f04aa3ed51fc315fb5b8729a (patch)
treeaa7d0bb009a5495f4ba524cfcbd4e36704c0d9eb /ceval.lisp
parent546c54613a397996e3faa04173bfa73a08a6ee47 (diff)
downloadlsp-1167e1207e3c0928f04aa3ed51fc315fb5b8729a.tar.gz
Flip-flop back to CL.
Diffstat (limited to 'ceval.lisp')
-rw-r--r--ceval.lisp23
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)))
+      ())))