summaryrefslogtreecommitdiff
path: root/vaporize/library/SpillEverywhere.java
diff options
context:
space:
mode:
Diffstat (limited to 'vaporize/library/SpillEverywhere.java')
-rw-r--r--vaporize/library/SpillEverywhere.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/vaporize/library/SpillEverywhere.java b/vaporize/library/SpillEverywhere.java
new file mode 100644
index 0000000..aa8368f
--- /dev/null
+++ b/vaporize/library/SpillEverywhere.java
@@ -0,0 +1,84 @@
+package vaporize.library;
+
+import cs132.vapor.ast.*;
+import st.*;
+import misc.*;
+import java.util.*;
+
+public class SpillEverywhere<P, R> extends VInstr.VisitorPR<P, R, RuntimeException> {
+
+ ArrayList<String> vapor;
+ String vaporm;
+
+
+ public SpillEverywhere(ArrayList<String> vapor) {
+ this.vapor = vapor;
+ this.vaporm = "";
+ }
+
+ public R visit(P p, VMemRead n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VMemWrite n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VAssign n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VBranch n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ System.out.println("NEXT: " +
+ return null;
+ }
+
+ public R visit(P p, VGoto n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VCall n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VBuiltIn n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.op.name,
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VReturn n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ }