blob: 6990d35cc30a20d800452d1ae8c4e57073f70dfd (
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
24
25
26
27
28
29
30
31
32
|
(def clear ()
(= types* (table))
(= memory* (table))
(= function* (table)))
(clear)
(def add-fns (fns)
(each (name . body) fns
(= function*.name body)))
(def run (instrs)
(each instr instrs
;? (prn instr)
(let (oarg1 <- op arg1 arg2) instr
;? (prn op)
(case op
loadi
(= memory*.oarg1 arg1)
add
(= memory*.oarg1
(+ memory*.arg1 memory*.arg2))
; else
(prn "aaa") ; user-defined functions go here
))))
(awhen cdr.argv
(each file it
;? (prn file)
(add-fns readfile.file))
;? (prn function*)
(run function*!main)
(prn memory*))
|