diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-07-06 00:07:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-07-06 00:07:03 -0700 |
commit | e74ff41321eded0d2e22449b17ac29c38f3abf2c (patch) | |
tree | d7e25fd6f1d8988430534bfbcc0e8e0bfe56df48 | |
download | mu-e74ff41321eded0d2e22449b17ac29c38f3abf2c.tar.gz |
0
-rw-r--r-- | mu.arc | 20 | ||||
-rw-r--r-- | mu.arc.t | 8 | ||||
-rw-r--r-- | x.mu | 4 |
3 files changed, 32 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc new file mode 100644 index 00000000..3c02fcec --- /dev/null +++ b/mu.arc @@ -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*)) diff --git a/mu.arc.t b/mu.arc.t new file mode 100644 index 00000000..72cbad74 --- /dev/null +++ b/mu.arc.t @@ -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")) diff --git a/x.mu b/x.mu new file mode 100644 index 00000000..06b62c25 --- /dev/null +++ b/x.mu @@ -0,0 +1,4 @@ +(1 <- loadi 1) +(2 <- loadi 3) +(3 <- add 1 2) +(prn 3) |