about summary refs log tree commit diff stats
path: root/mu.arc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-07-17 09:21:27 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-07-17 09:21:27 -0700
commitb794da7fe9b79f4e49ca5a5390f3e7f9b3bb7acb (patch)
tree9a87b40a21a55ca13395116f1b5be80e56d65042 /mu.arc
parent6215fec22513faaf31e01b6feee0aad59cb2560a (diff)
downloadmu-b794da7fe9b79f4e49ca5a5390f3e7f9b3bb7acb.tar.gz
28 - support 'continue'
We still haven't verified that the generated code is correct.
Also, time to fix that bug in arc's continue.
Diffstat (limited to 'mu.arc')
-rw-r--r--mu.arc20
1 files changed, 20 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc
index 0d0ea21b..c01bcdde 100644
--- a/mu.arc
+++ b/mu.arc
@@ -127,6 +127,10 @@
             (do
 ;?               (prn pc " " instr)
               (++ pc))
+            ; hack: racket replaces curlies with parens, so we need the
+            ; keyword begin to delimit blocks.
+            ; ultimately there'll be no nesting and curlies will just be in a
+            ; line by themselves.
             (do
 ;?               (prn `(open ,pc))
               (push `(open ,pc) locs)
@@ -153,10 +157,26 @@
                       (assert:is oarg nil)
                       (recur arg)
                       (pop stack))
+                  break
+                    (do
+                      (assert:is oarg nil)
+                      (assert:is arg nil)
+                      (yield `(jmp (offset ,(close-offset pc locs)))))
                   breakif
                     (do
 ;?                       (prn "breakif: " instr)
+                      (assert:is oarg nil)
                       (yield `(jif ,arg.0 (offset ,(close-offset pc locs)))))
+                  continue
+                    (do
+                      (assert:is oarg nil)
+                      (assert:is arg nil)
+                      (yield `(jmp (offset ,(- stack.0 pc)))))
+                  continueif
+                    (do
+;?                       (prn "continueif: " instr)
+                      (assert:is oarg nil)
+                      (yield `(jif ,arg.0 (offset ,(- stack.0 pc)))))
                   ;else
                     (yield instr))))
             (++ pc)))))))