public class typechecker {

//   Jay type checker - does parsing and type checking.

static StaticTypeCheck S = new StaticTypeCheck();
static TypeMap tm = new TypeMap();

public static void main(String args[]) {
   TokenStream MyProgram = new TokenStream(args[0]);
   ConcreteSyntax C  = new ConcreteSyntax(MyProgram);

   System.out.println("Begin parsing... " + args[0]);
   Program A = C.program();      // parse and generate abstract syntax tree
   A.display();               // display abstract syntax tree
   
   System.out.println("\nBegin type checking...");
   if (S.V(A)) {                 
      System.out.println("No type errors");
      System.out.print ("\n  Type map = ");
      tm = S.typing(A.decpart);  // generate type map from the declarations
      tm.display();              // and display it
   }                       
   else System.out.println("Type error");    
}

}

