gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control system
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d2765c4)
raw | patch | inline | side by side (parent: d2765c4)
author | Doni Pracner <quinnuendo@gmail.com> | |
Tue, 10 Dec 2013 22:03:33 +0000 (23:03 +0100) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Tue, 10 Dec 2013 22:26:26 +0000 (23:26 +0100) |
src/mjc2wsl.java | patch | blob | history |
diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java
index b7c572b609049776dfe8e73865b24ce3723d24a1..f84fc3a29ae758a6575b950d061f6ed936d42487 100644 (file)
--- a/src/mjc2wsl.java
+++ b/src/mjc2wsl.java
ret.append("VAR < tempa := 0, tempb := 0, tempres :=0,\n");
for (int i = 0; i <= 3; i++)
ret.append("loc" + i + " := 0, ");
- ret.append("\n estack := < >, t_e_m_p := 0 > :");
+ ret.append("\n estack := < >, mstack := < >, t_e_m_p := 0 > :");
return ret.toString();
}
return "C:\"" + type + str.replace("\"", "''") + "\";";
}
+ //Expression stack
+
private String cmdToEStack(int i) {
return "estack := <" + i + " > ++ estack;";
}
return cmdFromEStack("tempa");
}
+ //Method stack
+
+ private String cmdToMStack(int i) {
+ return "mstack := <" + i + " > ++ mstack;";
+ }
+
+ private String cmdToMStack(String i) {
+ return "mstack := <" + i + " > ++ mstack;";
+ }
+
+ private String cmdFromMStack(String st) {
+ return st + " := HEAD(mstack); mstack := TAIL(mstack);";
+ }
+
private String getRelationFor(int opcode) throws Exception {
switch (opcode) {
case jeq: return "=";
break;
}
- //TODO call
+ case call: {
+ prl(cmdToMStack(counter+2));
+ prl("CALL a" + (counter + get2()) + ";");
+ break;
+ }
case return_: {
prl(createComment("return not fully procesed yet"));