From f08708ee07931db592ffb76c073bd80bcf6cf060 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Tue, 16 Apr 2024 16:52:57 -0600 Subject: Override BoilSimp constructor --- J2V.java | 3 +-- boil/library/BoilSimp.java | 9 +++++---- 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(), symt); root.accept(new SymTableTopDown(), 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 { - 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 { * f2 -> */ public String visit(Goal n, String args) { - this.vapor = ""; String mod = ""; n.f0.accept(this, args); n.f1.accept(this, args); -- cgit v1.2.3