diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-07-31 01:47:32 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-07-31 01:47:32 -0700 |
commit | b90a10d2654d8e8610114750ba95ef543101ef0b (patch) | |
tree | 06017970e3318a92c6c277affddc75df651aae74 | |
parent | c41a0c27393f305ce73627b5d039671ce412003b (diff) | |
download | mu-b90a10d2654d8e8610114750ba95ef543101ef0b.tar.gz |
9 - shuffle operand type tag to after operand value
This organization should permit multiple metadata tags beyond just type. Starting to feel some pain from code not being DRY. Issues that took debugging: a poor search-and-replace, and shuffling offset in convert-braces.
-rw-r--r-- | mu.arc | 20 | ||||
-rw-r--r-- | mu.arc.t | 398 |
2 files changed, 209 insertions, 209 deletions
diff --git a/mu.arc b/mu.arc index 73e9ae5e..6c93e237 100644 --- a/mu.arc +++ b/mu.arc @@ -18,7 +18,7 @@ (= function*.name body))) (mac m (loc) - `(memory* (,loc 1))) + `(memory* (,loc 0))) (def run (instrs (o fn-args) (o fn-oargs)) (ret result nil @@ -38,7 +38,7 @@ literal (= (m oarg.0) arg.0) add -;? (do (prn "add " arg.0.1 arg.1.1) +;? (do (prn "add " (m arg.0) (m arg.1)) (= (m oarg.0) (+ (m arg.0) (m arg.1))) ;? (prn "add2")) @@ -92,15 +92,15 @@ (m fn-args.idx))) otype (= (m oarg.0) - ((fn-oargs arg.0) 0)) + ((fn-oargs arg.0) 1)) jmp - (do (= pc (+ pc arg.0.1)) ; relies on continue still incrementing (bug) + (do (= pc (+ pc arg.0.0)) ; relies on continue still incrementing (bug) ;? (prn "jumping to " pc) (continue)) jif (when (is t (m arg.0)) -;? (prn "jumping to " arg.1.1) - (= pc (+ pc arg.1.1)) ; relies on continue still incrementing (bug) + (= pc (+ pc arg.1.0)) ; relies on continue still incrementing (bug) +;? (prn "jumping to " pc) (continue)) copy (= (m oarg.0) (m arg.0)) @@ -168,22 +168,22 @@ (do (assert:is oarg nil) (assert:is arg nil) - (yield `(jmp (offset ,(close-offset pc locs))))) + (yield `(jmp (,(close-offset pc locs) offset)))) breakif (do ;? (prn "breakif: " instr) (assert:is oarg nil) - (yield `(jif ,arg.0 (offset ,(close-offset pc locs))))) + (yield `(jif ,arg.0 (,(close-offset pc locs) offset)))) continue (do (assert:is oarg nil) (assert:is arg nil) - (yield `(jmp (offset ,(- stack.0 pc))))) + (yield `(jmp (,(- stack.0 pc) offset)))) continueif (do ;? (prn "continueif: " instr) (assert:is oarg nil) - (yield `(jif ,arg.0 (offset ,(- stack.0 pc))))) + (yield `(jif ,arg.0 (,(- stack.0 pc) offset)))) ;else (yield instr)))) (++ pc))))))) diff --git a/mu.arc.t b/mu.arc.t index 9bba48e3..a054a48e 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -2,16 +2,16 @@ (clear) (add-fns '((test1 - ((integer 1) <- literal 1)))) + ((1 integer) <- literal 1)))) (run function*!test1) (if (~iso memory* (obj 1 1)) (prn "F - 'literal' writes a literal value (its lone 'arg' after the instruction name) to a location in memory (an address) specified by its lone 'oarg' or output arg before the arrow")) (clear) (add-fns '((test1 - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) - ((integer 3) <- add (integer 1) (integer 2))))) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) + ((3 integer) <- add (1 integer) (2 integer))))) (run function*!test1) (if (~iso memory* (obj 1 1 2 3 3 4)) (prn "F - 'add' operates on two addresses")) @@ -19,10 +19,10 @@ (clear) (add-fns '((test1 - ((integer 3) <- add (integer 1) (integer 2))) + ((3 integer) <- add (1 integer) (2 integer))) (main - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) (test1)))) (run function*!main) ;? (prn memory*) @@ -32,12 +32,12 @@ (clear) (add-fns '((test1 - ((integer 3) <- add (integer 1) (integer 2)) + ((3 integer) <- add (1 integer) (2 integer)) (reply) - ((integer 4) <- literal 34)) + ((4 integer) <- literal 34)) (main - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) (test1)))) (run function*!main) ;? (prn memory*) @@ -48,15 +48,15 @@ (clear) (add-fns '((test1 - ((integer 4) <- arg) - ((integer 5) <- arg) - ((integer 3) <- add (integer 4) (integer 5)) + ((4 integer) <- arg) + ((5 integer) <- arg) + ((3 integer) <- add (4 integer) (5 integer)) (reply) - ((integer 4) <- literal 34)) + ((4 integer) <- literal 34)) (main - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) - (test1 (integer 1) (integer 2)) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) + (test1 (1 integer) (2 integer)) ))) (run function*!main) ;? (prn memory*) @@ -69,15 +69,15 @@ (clear) (add-fns '((test1 - ((integer 5) <- arg 1) - ((integer 4) <- arg 0) - ((integer 3) <- add (integer 4) (integer 5)) + ((5 integer) <- arg 1) + ((4 integer) <- arg 0) + ((3 integer) <- add (4 integer) (5 integer)) (reply) - ((integer 4) <- literal 34)) + ((4 integer) <- literal 34)) (main - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) - (test1 (integer 1) (integer 2)) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) + (test1 (1 integer) (2 integer)) ))) (run function*!main) ;? (prn memory*) @@ -90,15 +90,15 @@ (clear) (add-fns '((test1 - ((integer 4) <- arg) - ((integer 5) <- arg) - ((integer 6) <- add (integer 4) (integer 5)) - (reply (integer 6)) - ((integer 4) <- literal 34)) + ((4 integer) <- arg) + ((5 integer) <- arg) + ((6 integer) <- add (4 integer) (5 integer)) + (reply (6 integer)) + ((4 integer) <- literal 34)) (main - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) - ((integer 3) <- test1 (integer 1) (integer 2))))) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) + ((3 integer) <- test1 (1 integer) (2 integer))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 1 2 3 3 4 @@ -109,15 +109,15 @@ (clear) (add-fns '((test1 - ((integer 4) <- arg) - ((integer 5) <- arg) - ((integer 6) <- add (integer 4) (integer 5)) - (reply (integer 6) (integer 5)) - ((integer 4) <- literal 34)) + ((4 integer) <- arg) + ((5 integer) <- arg) + ((6 integer) <- add (4 integer) (5 integer)) + (reply (6 integer) (5 integer)) + ((4 integer) <- literal 34)) (main - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) - ((integer 3) (integer 7) <- test1 (integer 1) (integer 2))))) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) + ((3 integer) (7 integer) <- test1 (1 integer) (2 integer))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 1 2 3 3 4 7 3 @@ -128,9 +128,9 @@ (clear) (add-fns '((main - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) - ((integer 3) <- sub (integer 1) (integer 2))))) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) + ((3 integer) <- sub (1 integer) (2 integer))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 1 2 3 3 -2)) @@ -139,9 +139,9 @@ (clear) (add-fns '((main - ((integer 1) <- literal 2) - ((integer 2) <- literal 3) - ((integer 3) <- mul (integer 1) (integer 2))))) + ((1 integer) <- literal 2) + ((2 integer) <- literal 3) + ((3 integer) <- mul (1 integer) (2 integer))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 2 2 3 3 6)) @@ -150,9 +150,9 @@ (clear) (add-fns '((main - ((integer 1) <- literal 8) - ((integer 2) <- literal 3) - ((integer 3) <- div (integer 1) (integer 2))))) + ((1 integer) <- literal 8) + ((2 integer) <- literal 3) + ((3 integer) <- div (1 integer) (2 integer))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 8 2 3 3 (/ real.8 3))) @@ -161,9 +161,9 @@ (clear) (add-fns '((main - ((integer 1) <- literal 8) - ((integer 2) <- literal 3) - ((integer 3) (integer 4) <- idiv (integer 1) (integer 2))))) + ((1 integer) <- literal 8) + ((2 integer) <- literal 3) + ((3 integer) (4 integer) <- idiv (1 integer) (2 integer))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 8 2 3 3 2 4 2)) @@ -172,9 +172,9 @@ (clear) (add-fns '((main - ((boolean 1) <- literal t) - ((boolean 2) <- literal nil) - ((boolean 3) <- and (boolean 1) (boolean 2))))) + ((1 boolean) <- literal t) + ((2 boolean) <- literal nil) + ((3 boolean) <- and (1 boolean) (2 boolean))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 t 2 nil 3 nil)) @@ -183,9 +183,9 @@ (clear) (add-fns '((main - ((boolean 1) <- literal 4) - ((boolean 2) <- literal 3) - ((boolean 3) <- lt (boolean 1) (boolean 2))))) + ((1 boolean) <- literal 4) + ((2 boolean) <- literal 3) + ((3 boolean) <- lt (1 boolean) (2 boolean))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 4 2 3 3 nil)) @@ -194,9 +194,9 @@ (clear) (add-fns '((main - ((boolean 1) <- literal 4) - ((boolean 2) <- literal 3) - ((boolean 3) <- le (boolean 1) (boolean 2))))) + ((1 boolean) <- literal 4) + ((2 boolean) <- literal 3) + ((3 boolean) <- le (1 boolean) (2 boolean))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 4 2 3 3 nil)) @@ -205,9 +205,9 @@ (clear) (add-fns '((main - ((boolean 1) <- literal 4) - ((boolean 2) <- literal 4) - ((boolean 3) <- le (boolean 1) (boolean 2))))) + ((1 boolean) <- literal 4) + ((2 boolean) <- literal 4) + ((3 boolean) <- le (1 boolean) (2 boolean))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 4 2 4 3 t)) @@ -216,9 +216,9 @@ (clear) (add-fns '((main - ((boolean 1) <- literal 4) - ((boolean 2) <- literal 5) - ((boolean 3) <- le (boolean 1) (boolean 2))))) + ((1 boolean) <- literal 4) + ((2 boolean) <- literal 5) + ((3 boolean) <- le (1 boolean) (2 boolean))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 4 2 5 3 t)) @@ -227,9 +227,9 @@ (clear) (add-fns '((main - ((integer 1) <- literal 8) - (jmp (offset 1)) - ((integer 2) <- literal 3) + ((1 integer) <- literal 8) + (jmp (1 offset)) + ((2 integer) <- literal 3) (reply)))) (run function*!main) ;? (prn memory*) @@ -239,11 +239,11 @@ (clear) (add-fns '((main - ((integer 1) <- literal 8) - (jmp (offset 1)) - ((integer 2) <- literal 3) + ((1 integer) <- literal 8) + (jmp (1 offset)) + ((2 integer) <- literal 3) (reply) - ((integer 3) <- literal 34)))) + ((3 integer) <- literal 34)))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 8)) @@ -252,13 +252,13 @@ (clear) (add-fns '((main - ((integer 1) <- literal 1) - ((integer 2) <- literal 1) - ((boolean 3) <- eq (integer 1) (integer 2)) - (jif (boolean 3) (offset 1)) - ((integer 2) <- literal 3) + ((1 integer) <- literal 1) + ((2 integer) <- literal 1) + ((3 boolean) <- eq (1 integer) (2 integer)) + (jif (3 boolean) (1 offset)) + ((2 integer) <- literal 3) (reply) - ((integer 3) <- literal 34)))) + ((3 integer) <- literal 34)))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 1 2 1 3 t)) @@ -267,13 +267,13 @@ (clear) (add-fns '((main - ((integer 1) <- literal 1) - ((integer 2) <- literal 2) - ((boolean 3) <- eq (integer 1) (integer 2)) - (jif (boolean 3) (offset 1)) - ((integer 4) <- literal 3) + ((1 integer) <- literal 1) + ((2 integer) <- literal 2) + ((3 boolean) <- eq (1 integer) (2 integer)) + (jif (3 boolean) (1 offset)) + ((4 integer) <- literal 3) (reply) - ((integer 3) <- literal 34)))) + ((3 integer) <- literal 34)))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 1 2 2 3 nil 4 3)) @@ -282,14 +282,14 @@ (clear) (add-fns '((main - ((integer 1) <- literal 2) - ((integer 2) <- literal 1) - ((integer 2) <- add (integer 2) (integer 2)) - ((boolean 3) <- eq (integer 1) (integer 2)) - (jif (boolean 3) (offset -3)) - ((integer 4) <- literal 3) + ((1 integer) <- literal 2) + ((2 integer) <- literal 1) + ((2 integer) <- add (2 integer) (2 integer)) + ((3 boolean) <- eq (1 integer) (2 integer)) + (jif (3 boolean) (-3 offset)) + ((4 integer) <- literal 3) (reply) - ((integer 3) <- literal 34)))) + ((3 integer) <- literal 34)))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 2 2 4 3 nil 4 3)) @@ -298,18 +298,18 @@ (clear) (add-fns '((test1 - ((type 4) <- otype 0) - ((type 5) <- literal integer) - ((boolean 6) <- neq (type 4) (type 5)) - (jif (boolean 6) (offset 3)) - ((integer 7) <- arg) - ((integer 8) <- arg) - ((integer 9) <- add (integer 7) (integer 8)) - (reply (integer 9))) + ((4 type) <- otype 0) + ((5 type) <- literal integer) + ((6 boolean) <- neq (4 type) (5 type)) + (jif (6 boolean) (3 offset)) + ((7 integer) <- arg) + ((8 integer) <- arg) + ((9 integer) <- add (7 integer) (8 integer)) + (reply (9 integer))) (main - ((integer 1) <- literal 1) - ((integer 2) <- literal 3) - ((integer 3) <- test1 (integer 1) (integer 2))))) + ((1 integer) <- literal 1) + ((2 integer) <- literal 3) + ((3 integer) <- test1 (1 integer) (2 integer))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj 1 1 2 3 3 4 @@ -320,25 +320,25 @@ (clear) (add-fns '((add-fn - ((type 4) <- otype 0) - ((type 5) <- literal integer) - ((boolean 6) <- neq (type 4) (type 5)) - (jif (boolean 6) (offset 4)) - ((integer 7) <- arg) - ((integer 8) <- arg) - ((integer 9) <- add (integer 7) (integer 8)) - (reply (integer 9)) - ((type 5) <- literal boolean) - ((boolean 6) <- neq (type 4) (type 5)) - (jif (boolean 6) (offset 6)) - ((boolean 7) <- arg) - ((boolean 8) <- arg) - ((boolean 9) <- or (boolean 7) (boolean 8)) - (reply (boolean 9))) + ((4 type) <- otype 0) + ((5 type) <- literal integer) + ((6 boolean) <- neq (4 type) (5 type)) + (jif (6 boolean) (4 offset)) + ((7 integer) <- arg) + ((8 integer) <- arg) + ((9 integer) <- add (7 integer) (8 integer)) + (reply (9 integer)) + ((5 type) <- literal boolean) + ((6 boolean) <- neq (4 type) (5 type)) + (jif (6 boolean) (6 offset)) + ((7 boolean) <- arg) + ((8 boolean) <- arg) + ((9 boolean) <- or (7 boolean) (8 boolean)) + (reply (9 boolean))) (main - ((boolean 1) <- literal t) - ((boolean 2) <- literal t) - ((boolean 3) <- add-fn (boolean 1) (boolean 2))))) + ((1 boolean) <- literal t) + ((2 boolean) <- literal t) + ((3 boolean) <- add-fn (1 boolean) (2 boolean))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj ; first call to add-fn @@ -350,28 +350,28 @@ (clear) (add-fns '((add-fn - ((type 4) <- otype 0) - ((type 5) <- literal integer) - ((boolean 6) <- neq (type 4) (type 5)) - (jif (boolean 6) (offset 4)) - ((integer 7) <- arg) - ((integer 8) <- arg) - ((integer 9) <- add (integer 7) (integer 8)) - (reply (integer 9)) - ((type 5) <- literal boolean) - ((boolean 6) <- neq (type 4) (type 5)) - (jif (boolean 6) (offset 6)) - ((boolean 7) <- arg) - ((boolean 8) <- arg) - ((boolean 9) <- or (boolean 7) (boolean 8)) - (reply (boolean 9))) + ((4 type) <- otype 0) + ((5 type) <- literal integer) + ((6 boolean) <- neq (4 type) (5 type)) + (jif (6 boolean) (4 offset)) + ((7 integer) <- arg) + ((8 integer) <- arg) + ((9 integer) <- add (7 integer) (8 integer)) + (reply (9 integer)) + ((5 type) <- literal boolean) + ((6 boolean) <- neq (4 type) (5 type)) + (jif (6 boolean) (6 offset)) + ((7 boolean) <- arg) + ((8 boolean) <- arg) + ((9 boolean) <- or (7 boolean) (8 boolean)) + (reply (9 boolean))) (main - ((boolean 1) <- literal t) - ((boolean 2) <- literal t) - ((boolean 3) <- add-fn (boolean 1) (boolean 2)) - ((integer 10) <- literal 3) - ((integer 11) <- literal 4) - ((integer 12) <- add-fn (integer 10) (integer 11))))) + ((1 boolean) <- literal t) + ((2 boolean) <- literal t) + ((3 boolean) <- add-fn (1 boolean) (2 boolean)) + ((10 integer) <- literal 3) + ((11 integer) <- literal 4) + ((12 integer) <- add-fn (10 integer) (11 integer))))) (run function*!main) ;? (prn memory*) (if (~iso memory* (obj ; first call to add-fn @@ -382,88 +382,88 @@ 4 'integer 5 'integer 6 nil 7 3 8 4 9 7)) (prn "F - different calls can exercise different clauses of the same function")) -(if (~iso (convert-braces '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) - ((integer 3) <- add (integer 2) (integer 2)) +(if (~iso (convert-braces '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) + ((3 integer) <- add (2 integer) (2 integer)) { begin ; 'begin' is just a hack because racket turns curlies into parens - ((boolean 4) <- neq (integer 1) (integer 3)) - (breakif (boolean 4)) - ((integer 5) <- literal 34) + ((4 boolean) <- neq (1 integer) (3 integer)) + (breakif (4 boolean)) + ((5 integer) <- literal 34) } (reply))) - '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) - ((integer 3) <- add (integer 2) (integer 2)) - ((boolean 4) <- neq (integer 1) (integer 3)) - (jif (boolean 4) (offset 1)) - ((integer 5) <- literal 34) + '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) + ((3 integer) <- add (2 integer) (2 integer)) + ((4 boolean) <- neq (1 integer) (3 integer)) + (jif (4 boolean) (1 offset)) + ((5 integer) <- literal 34) (reply))) (prn "F - convert-braces replaces breakif with a jif to after the next close curly")) -(if (~iso (convert-braces '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) - ((integer 3) <- add (integer 2) (integer 2)) +(if (~iso (convert-braces '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) + ((3 integer) <- add (2 integer) (2 integer)) { begin (break) } (reply))) - '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) - ((integer 3) <- add (integer 2) (integer 2)) - (jmp (offset 0)) + '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) + ((3 integer) <- add (2 integer) (2 integer)) + (jmp (0 offset)) (reply))) (prn "F - convert-braces works for degenerate blocks")) -(if (~iso (convert-braces '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) - ((integer 3) <- add (integer 2) (integer 2)) +(if (~iso (convert-braces '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) + ((3 integer) <- add (2 integer) (2 integer)) { begin - ((boolean 4) <- neq (integer 1) (integer 3)) - (breakif (boolean 4)) + ((4 boolean) <- neq (1 integer) (3 integer)) + (breakif (4 boolean)) { begin - ((integer 5) <- literal 34) + ((5 integer) <- literal 34) } } (reply))) - '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) - ((integer 3) <- add (integer 2) (integer 2)) - ((boolean 4) <- neq (integer 1) (integer 3)) - (jif (boolean 4) (offset 1)) - ((integer 5) <- literal 34) + '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) + ((3 integer) <- add (2 integer) (2 integer)) + ((4 boolean) <- neq (1 integer) (3 integer)) + (jif (4 boolean) (1 offset)) + ((5 integer) <- literal 34) (reply))) (prn "F - convert-braces balances curlies when converting break")) -(if (~iso (convert-braces '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) +(if (~iso (convert-braces '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) { begin - ((integer 3) <- add (integer 2) (integer 2)) + ((3 integer) <- add (2 integer) (2 integer)) { begin - ((boolean 4) <- neq (integer 1) (integer 3)) + ((4 boolean) <- neq (1 integer) (3 integer)) } - (continueif (boolean 4)) - ((integer 5) <- literal 34) + (continueif (4 boolean)) + ((5 integer) <- literal 34) } (reply))) - '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) - ((integer 3) <- add (integer 2) (integer 2)) - ((boolean 4) <- neq (integer 1) (integer 3)) - (jif (boolean 4) (offset -3)) - ((integer 5) <- literal 34) + '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) + ((3 integer) <- add (2 integer) (2 integer)) + ((4 boolean) <- neq (1 integer) (3 integer)) + (jif (4 boolean) (-3 offset)) + ((5 integer) <- literal 34) (reply))) (prn "F - convert-braces balances curlies when converting continue")) (clear) -(add-fns `((main ,@(convert-braces '(((integer 1) <- literal 4) - ((integer 2) <- literal 1) +(add-fns `((main ,@(convert-braces '(((1 integer) <- literal 4) + ((2 integer) <- literal 1) { begin - ((integer 2) <- add (integer 2) (integer 2)) + ((2 integer) <- add (2 integer) (2 integer)) { begin - ((boolean 3) <- neq (integer 1) (integer 2)) + ((3 boolean) <- neq (1 integer) (2 integer)) } - (continueif (boolean 3)) - ((integer 4) <- literal 34) + (continueif (3 boolean)) + ((4 integer) <- literal 34) } (reply)))))) (run function*!main) @@ -472,15 +472,15 @@ (prn "F - continue correctly loops")) (clear) -(add-fns `((main ,@(convert-braces '(((integer 1) <- literal 4) - ((integer 2) <- literal 2) +(add-fns `((main ,@(convert-braces '(((1 integer) <- literal 4) + ((2 integer) <- literal 2) { begin - ((integer 2) <- add (integer 2) (integer 2)) + ((2 integer) <- add (2 integer) (2 integer)) { begin - ((boolean 3) <- neq (integer 1) (integer 2)) + ((3 boolean) <- neq (1 integer) (2 integer)) } - (continueif (boolean 3)) - ((integer 4) <- literal 34) + (continueif (3 boolean)) + ((4 integer) <- literal 34) } (reply)))))) (run function*!main) |