From acb209e4bef36186744ee09c67fcad77550e78d2 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Sun, 17 Mar 2024 21:37:38 -0600 Subject: Pretty printing for TypeCheckSimp, start for symbol table --- Typecheck.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Typecheck.java') 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=Void, A=String. PPrinter pp = new PPrinter(); root.accept(pp, ""); + System.out.println("==================================================="); // // Build the symbol table. Top-down visitor, inherits from // // GJDepthFirst. R=Void, A=Integer. - // SymTableVis pv = - // new SymTableVis(); - // root.accept(pv, 0); - // HashMap symt = pv.symt; + SymTableVis pv = + new SymTableVis(); + root.accept(pv, 0); + HashMap 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 -- cgit v1.2.3