about summary refs log tree commit diff stats
path: root/eval.lsp
blob: 60a19c0122fc7aa150b5fa6a4f2e79b1737028ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)))
      ())))