This commit is contained in:
parent
ff8b3afd09
commit
77f8e6cd25
14
mu.arc
14
mu.arc
|
@ -8,6 +8,11 @@
|
|||
(= function* (table)))
|
||||
(clear)
|
||||
|
||||
(mac aelse (test else . body)
|
||||
`(aif ,test
|
||||
(do ,@body)
|
||||
,else))
|
||||
|
||||
(def add-fns (fns)
|
||||
(each (name . body) fns
|
||||
(= function*.name body)))
|
||||
|
@ -52,11 +57,12 @@
|
|||
(do (= result arg)
|
||||
(break))
|
||||
; else user-defined function
|
||||
(let results (run function*.op arg)
|
||||
(aelse function*.op (prn "no definition for " op)
|
||||
;? (prn "== " memory*)
|
||||
(each o oarg
|
||||
;? (prn o)
|
||||
(= (memory* o.1) (memory* pop.results.1))))
|
||||
(let results (run it arg)
|
||||
(each o oarg
|
||||
;? (prn o)
|
||||
(= (memory* o.1) (memory* pop.results.1)))))
|
||||
)))))
|
||||
;? (prn "return " result)
|
||||
))
|
||||
|
|
12
mu.arc.t
12
mu.arc.t
|
@ -139,3 +139,15 @@
|
|||
;? (prn memory*)
|
||||
(if (~iso memory* (obj 1 8 2 3 3 2 4 2))
|
||||
(prn "F - idiv works"))
|
||||
|
||||
(clear)
|
||||
(add-fns
|
||||
'((main
|
||||
((integer 1) <- loadi 8)
|
||||
(jmp (location 3))
|
||||
((integer 2) <- loadi 3)
|
||||
(reply))))
|
||||
(run function*!main)
|
||||
;? (prn memory*)
|
||||
(if (~iso memory* (obj 1 8))
|
||||
(prn "F - jmp works"))
|
||||
|
|
Loading…
Reference in New Issue