about summary refs log tree commit diff stats
path: root/ceval.lisp
diff options
context:
space:
mode:
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)))
+      ())))