From: Doni Pracner Date: Sun, 5 Jan 2014 20:40:19 +0000 (+0100) Subject: mjc2wsl - jumps have ELSE branches, so that actions have normal ends for the recursiv... X-Git-Tag: v0.1.4~40 X-Git-Url: http://svarog.pmf.uns.ac.rs/gitweb/?p=mjc2wsl.git;a=commitdiff_plain;h=1b7d6ae9ea605e75294f59d4fbe86968d93bacd9;ds=sidebyside mjc2wsl - jumps have ELSE branches, so that actions have normal ends for the recursive returns --- diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java index f05d271..2f6aa8d 100644 --- a/src/mjc2wsl.java +++ b/src/mjc2wsl.java @@ -270,6 +270,10 @@ public class mjc2wsl{ } throw new Exception("Wrong opcode for a relation"); } + + private boolean isJumpCode(int opcode) { + return (opcode>=jmp) && (opcode<=jge); + } public void convertStream(InputStream ins) throws Exception{ mainIn = ins; @@ -389,6 +393,7 @@ public class mjc2wsl{ prl(getTopTwo()); prl("IF tempb "+ getRelationFor(op) +" tempa THEN CALL a" + (counter + get2()) + +" ELSE CALL a" + (counter+1) + " FI;"); break; } @@ -458,9 +463,13 @@ public class mjc2wsl{ break; } + boolean wasJump = isJumpCode(op); op = get(); if (op >= 0) - prl("CALL a" + counter + " END"); + if (wasJump) + prl("SKIP END"); + else + prl("CALL a" + counter + " END"); } prl("CALL Z;\nSKIP END\nENDACTIONS;\n"); prl(getStandardEnd());