about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--mu.arc20
-rw-r--r--mu.arc.t8
-rw-r--r--x.mu4
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)