gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control systemdiff --git a/src/mjc2wsl.java b/src/mjc2wsl.java
--- a/src/mjc2wsl.java
+++ b/src/mjc2wsl.java
* @author Doni Pracner, http://perun.dmi.rs/pracner http://quemaster.com
*/
public class mjc2wsl{
* @author Doni Pracner, http://perun.dmi.rs/pracner http://quemaster.com
*/
public class mjc2wsl{
- public static String versionN = "0.1.5";
+ public static String versionN = "0.1.6";
private TransMessages messages = new TransMessages();
private TransMessages messages = new TransMessages();
+"C:\" with mjc2wsl v "+versionN+"\";\n");
ret.append("BEGIN ");
+"C:\" with mjc2wsl v "+versionN+"\";\n");
ret.append("BEGIN ");
- ret.append("VAR < tempa := 0, tempb := 0, tempres :=0,\n\t");
+ ret.append("VAR < \n\t");
ret.append("mjvm_locals := ARRAY(1,0), ");
ret.append("\n\tmjvm_statics := ARRAY("+numWords+",0), ");
ret.append("\n\tmjvm_arrays := < >, ");
ret.append("mjvm_locals := ARRAY(1,0), ");
ret.append("\n\tmjvm_statics := ARRAY("+numWords+",0), ");
ret.append("\n\tmjvm_arrays := < >, ");
}
case add: {
}
case add: {
+ prl(createStartVar("tempa", "tempb", "tempres"));
prl(createTopTwoEStack());
prl("tempres := tempb + tempa;");
prl(createToEStack("tempres"));
prl(createTopTwoEStack());
prl("tempres := tempb + tempa;");
prl(createToEStack("tempres"));
+ prl(createEndVar());
break;
}
case sub: {
break;
}
case sub: {
+ prl(createStartVar("tempa", "tempb", "tempres"));
prl(createTopTwoEStack());
prl("tempres := tempb - tempa;");
prl(createToEStack("tempres"));
prl(createTopTwoEStack());
prl("tempres := tempb - tempa;");
prl(createToEStack("tempres"));
+ prl(createEndVar());
break;
}
case mul: {
break;
}
case mul: {
+ prl(createStartVar("tempa", "tempb", "tempres"));
prl(createTopTwoEStack());
prl("tempres := tempb * tempa;");
prl(createToEStack("tempres"));
prl(createTopTwoEStack());
prl("tempres := tempb * tempa;");
prl(createToEStack("tempres"));
+ prl(createEndVar());
break;
}
case div: {
break;
}
case div: {
}
case neg: {
}
case neg: {
+ prl(createStartVar("tempa"));
prl(createTopEStack());
prl(createToEStack("-tempa"));
prl(createTopEStack());
prl(createToEStack("-tempa"));
+ prl(createEndVar());
break;
}
break;
}
case jle:
case jgt:
case jge: {
case jle:
case jgt:
case jge: {
+ prl(createStartVar("tempa", "tempb"));
prl(createTopTwoEStack());
prl("IF tempb " + getRelationFor(op) + " tempa THEN CALL a"
+ (counter + get2()) + " ELSE CALL a" + (counter + 1)
+ " FI;");
prl(createTopTwoEStack());
prl("IF tempb " + getRelationFor(op) + " tempa THEN CALL a"
+ (counter + get2()) + " ELSE CALL a" + (counter + 1)
+ " FI;");
+ prl(createEndVar());
+
break;
}
break;
}
prl(createComment("char is read like a number", C_SPEC));
}
case read: {
prl(createComment("char is read like a number", C_SPEC));
}
case read: {
+ prl(createStartVar("tempa"));
prl("tempa := @String_To_Num(@Read_Line(Standard_Input_Port));");
prl(createToEStack("tempa"));
prl("tempa := @String_To_Num(@Read_Line(Standard_Input_Port));");
prl(createToEStack("tempa"));
+ prl(createEndVar());
break;
}
break;
}
}
case print: {
// TODO printing numbers needs different lengths of spacing
}
case print: {
// TODO printing numbers needs different lengths of spacing
+ prl(createStartVar("tempa", "tempb"));
+
prl(createTopTwoEStack());
prl("Print_MJ(tempb,tempa);");
prl(createTopTwoEStack());
prl("Print_MJ(tempb,tempa);");
+ prl(createEndVar());
break;
}
break;
}