From c71e5a3dd0f09ee95241f3a856aeadbf98527dcf Mon Sep 17 00:00:00 2001 From: Doni Pracner Date: Sun, 4 Nov 2012 22:02:45 +0100 Subject: [PATCH] counter problem in mjc2wsl fixed --- mjc2wsl.java | 4 ++-- samples/sample0.wsl | 48 ++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/mjc2wsl.java b/mjc2wsl.java index 7146de3..77d1c28 100644 --- a/mjc2wsl.java +++ b/mjc2wsl.java @@ -97,7 +97,7 @@ public class mjc2wsl{ private InputStream mainIn; private PrintWriter out = null; - private int counter = 0; + private int counter = -1; private void pr(int i){ out.print(i); @@ -183,7 +183,7 @@ public class mjc2wsl{ for (int i=0;i<14;i++) get(); prl(getStandardStart()); - prl("SKIP;\n ACTIONS A_S_start:\n A_S_start == CALL a15 END"); + prl("SKIP;\n ACTIONS A_S_start:\n A_S_start == CALL a14 END"); int op = get(); while (op>=0){ if (originalInComments) prl(createComment(""+op,C_OC)); diff --git a/samples/sample0.wsl b/samples/sample0.wsl index cc20ab3..7fcb024 100644 --- a/samples/sample0.wsl +++ b/samples/sample0.wsl @@ -1,64 +1,64 @@ C:" This file automatically converted from microjava bytecode"; -C:" with mjc2wsl v 0.1"; +C:" with mjc2wsl v 0.1.2"; VAR < tempa := 0, tempb := 0, tempres :=0, loc0 := 0, loc1 := 0, loc2 := 0, loc3 := 0, estack := < >, t_e_m_p := 0 > : SKIP; ACTIONS A_S_start: A_S_start == CALL a14 END -a15 == +a14 == C:" enter not fully procesed yet"; +CALL a17 END +a17 == +estack := <0 > ++ estack; CALL a18 END a18 == -estack := <0 > ++ estack; +loc0 := HEAD(estack); estack := TAIL(estack); CALL a19 END a19 == -loc0 := HEAD(estack); estack := TAIL(estack); +estack := ++ estack; CALL a20 END a20 == -estack := ++ estack; +estack := <5 > ++ estack; CALL a21 END a21 == -estack := <5 > ++ estack; -CALL a22 END -a22 == tempa := HEAD(estack); estack := TAIL(estack); tempb := HEAD(estack); estack := TAIL(estack); -IF tempb >= tempa THEN CALL a35 FI; +IF tempb >= tempa THEN CALL a34 FI; +CALL a24 END +a24 == +estack := ++ estack; CALL a25 END a25 == -estack := ++ estack; +estack := <0 > ++ estack; CALL a26 END a26 == -estack := <0 > ++ estack; -CALL a27 END -a27 == tempa := HEAD(estack); estack := TAIL(estack); tempb := HEAD(estack); estack := TAIL(estack); PRINT(tempb); +CALL a27 END +a27 == +estack := ++ estack; CALL a28 END a28 == -estack := ++ estack; +estack := <1 > ++ estack; CALL a29 END a29 == -estack := <1 > ++ estack; -CALL a30 END -a30 == tempa := HEAD(estack); estack := TAIL(estack); tempb := HEAD(estack); estack := TAIL(estack); tempres := tempb + tempa; estack := ++ estack; +CALL a30 END +a30 == +loc0 := HEAD(estack); estack := TAIL(estack); CALL a31 END a31 == -loc0 := HEAD(estack); estack := TAIL(estack); -CALL a32 END -a32 == -CALL a20; +CALL a19; +CALL a34 END +a34 == +C:" exit not fully procesed yet"; CALL a35 END a35 == -C:" exit not fully procesed yet"; -CALL a36 END -a36 == C:" return not fully procesed yet"; CALL Z; SKIP END -- 2.25.1