This commit is contained in:
commit
e74ff41321
|
@ -0,0 +1,20 @@
|
|||
(= types* (table))
|
||||
(= memory* (table))
|
||||
|
||||
(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))
|
||||
))))
|
||||
|
||||
(each file (cut argv 1)
|
||||
;? (prn file)
|
||||
(run readfile.file)
|
||||
(prn memory*))
|
|
@ -0,0 +1,8 @@
|
|||
(load "mu.arc")
|
||||
|
||||
(run '(
|
||||
(1 <- loadi 1)
|
||||
(2 <- loadi 3)
|
||||
(3 <- add 1 2)))
|
||||
(if (~iso memory* (obj 1 1 2 3 3 4))
|
||||
(prn "F - load and add instructions work"))
|
Loading…
Reference in New Issue