This commit is contained in:
Kartik K. Agaram 2014-07-06 00:07:03 -07:00
commit e74ff41321
3 changed files with 32 additions and 0 deletions

20
mu.arc Normal file
View File

@ -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*))

8
mu.arc.t Normal file
View File

@ -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"))

4
x.mu Normal file
View File

@ -0,0 +1,4 @@
(1 <- loadi 1)
(2 <- loadi 3)
(3 <- add 1 2)
(prn 3)