Commit 528d51ea authored by Julian Kranz's avatar Julian Kranz

Jgdrr

- Continued to implement jgdrr
parent 80ee5e79
......@@ -23,6 +23,6 @@ public class BranchStatement extends Statement {
@Override
public String toString() {
return "goto[" + hint + "] " + target;
return "goto[" + hint + "] " + target + ";";
}
}
......@@ -28,4 +28,10 @@ public class ConditionalBranchStatement extends Statement {
this.targetTrue = targetTrue;
this.targetFalse = targetFalse;
}
@Override
public String toString() {
return "if(" + condition + ") goto " + targetTrue + "; else goto "
+ targetFalse + ";";
}
}
......@@ -29,4 +29,17 @@ public class IfThenElseStatement extends Statement {
this.thenBranch = thenBranch;
this.elseBranch = elseBranch;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("if(" + condition + ") {\n");
for (int i = 0; i < thenBranch.size(); i++)
builder.append(thenBranch.get(i) + "\n");
builder.append("} else {\n");
for (int i = 0; i < elseBranch.size(); i++)
builder.append(elseBranch.get(i) + "\n");
builder.append("}");
return builder.toString();
}
}
......@@ -27,4 +27,9 @@ public class LoadStatement extends Statement {
this.size = size;
this.address = address;
}
@Override
public String toString() {
return lhs + " =: " + size + " *" + address;
}
}
......@@ -20,4 +20,9 @@ public class StoreStatement extends Statement {
this.address = address;
this.rhs = rhs;
}
@Override
public String toString() {
return "*" + address + " = " + rhs;
}
}
......@@ -20,4 +20,14 @@ public class WhileStatement extends Statement {
public WhileStatement(LinearExpression condition, ArrayList<Statement> body) {
this.body = body;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("while(" + condition + ") {\n");
for (int i = 0; i < body.size(); i++)
builder.append(body.get(i) + "\n");
builder.append("}");
return builder.toString();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment