summaryrefslogtreecommitdiff
path: root/Typecheck.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-03-17 21:37:38 -0600
committerbd-912 <bdunahu@colostate.edu>2024-03-17 21:37:38 -0600
commitacb209e4bef36186744ee09c67fcad77550e78d2 (patch)
tree85e27346b897200f2c06ee74b27ad6d2c798065b /Typecheck.java
parent6a24c69232901de51f50beab9c3d3b3760dee334 (diff)
Pretty printing for TypeCheckSimp, start for symbol table
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