summaryrefslogtreecommitdiff
path: root/Typecheck.java
diff options
context:
space:
mode:
Diffstat (limited to 'Typecheck.java')
-rw-r--r--Typecheck.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/Typecheck.java b/Typecheck.java
index be979f5..8e970be 100644
--- a/Typecheck.java
+++ b/Typecheck.java
@@ -16,13 +16,14 @@ public class Typecheck {
// GJDepthFirst<R,A>. R=Void, A=String.
PPrinter<Void,String> pp = new PPrinter<Void,String>();
root.accept(pp, "");
+ System.out.println("===================================================");
// // Build the symbol table. Top-down visitor, inherits from
// // GJDepthFirst<R,A>. R=Void, A=Integer.
- // SymTableVis<Void, Integer> pv =
- // new SymTableVis<Void,Integer>();
- // root.accept(pv, 0);
- // HashMap<String, String> symt = pv.symt;
+ SymTableVis<Void,Integer> pv =
+ new SymTableVis<Void,Integer>();
+ root.accept(pv, 0);
+ HashMap<String, TypeEnum> symt = pv.symt;
// Do type checking. Bottom-up visitor, also inherits from
// GJDepthFirst. Visit functions return MyTpe (=R), and
@@ -30,7 +31,7 @@ public class Typecheck {
// argument (=A). You may implement things differently of
// course!
TypeCheckSimp ts = new TypeCheckSimp();
- TypeInstance res = root.accept(ts, null);
+ TypeInstance res = root.accept(ts, symt);
// Ugly code not to be inspired from: "my" way of storing
// type info / typecheck property: if some of my internal