summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-16 16:52:57 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-16 16:53:22 -0600
commitf08708ee07931db592ffb76c073bd80bcf6cf060 (patch)
treeaf72fc332cbcc2f580d022989330168f76b849c2
parent27de8a34f346cddef322c7b65555ddb803532d74 (diff)
Override BoilSimp constructor
-rw-r--r--J2V.java3
-rw-r--r--boil/library/BoilSimp.java9
2 files changed, 6 insertions, 6 deletions
diff --git a/J2V.java b/J2V.java
index 5a16dad..372f1c8 100644
--- a/J2V.java
+++ b/J2V.java
@@ -24,8 +24,7 @@ public class J2V {
root.accept(new SymTableBottomUp<Void>(), symt);
root.accept(new SymTableTopDown<Void>(), symt);
- BoilSimp vp = new BoilSimp();
- vp.setSymbolTable(symt);
+ BoilSimp vp = new BoilSimp(symt);
root.accept(vp, "");
PrintFilter.print("===================================================", true);
diff --git a/boil/library/BoilSimp.java b/boil/library/BoilSimp.java
index 0c391db..1de93d1 100644
--- a/boil/library/BoilSimp.java
+++ b/boil/library/BoilSimp.java
@@ -8,12 +8,14 @@ import java.util.*;
public class BoilSimp extends GJDepthFirst<String,String> {
- private String vapor; // the collected vapor program
- private TypeFactory tf = new TypeFactory(); // the shared type generator
+ private String vapor; // the collected vapor program
+ private TypeFactory tf; // the shared type generator
private SymbolTable symt;
- public void setSymbolTable(SymbolTable symt) {
+ public BoilSimp(SymbolTable symt) {
this.symt = symt;
+ this.vapor = "";
+ this.tf = new TypeFactory();
}
public String getVapor() {
@@ -76,7 +78,6 @@ public class BoilSimp extends GJDepthFirst<String,String> {
* f2 -> <EOF>
*/
public String visit(Goal n, String args) {
- this.vapor = "";
String mod = "";
n.f0.accept(this, args);
n.f1.accept(this, args);