package edu.cmu.cs.l3.translate;

/** A class for testing out the translator, for debugging purposes. */
import edu.cmu.cs.l3.x86.*;
import edu.cmu.cs.l3.tree.*;
import java.util.*;
import edu.cmu.cs.l3.semant.*;
import edu.cmu.cs.l3.general.*;

public class TranslateMain {

  public static void go(String filename, boolean canon)  {

      Translator t = new Translator(new FrameIntel());

      List prog = t.translate(filename, canon);
      int i;
      IRPrint printer = new IRPrint(System.out);

      for (i = 0; i < prog.size(); i++) {
          Fragment frag = (Fragment) prog.get(i);
          if (frag instanceof FragmentCode) {
              FragmentCode cfrag = (FragmentCode) frag;
              System.out.println("FRAGCODE:" + cfrag.getName());
              cfrag.getCode().visit(printer);
          }
          System.out.println();
      }

      System.out.println();
      Globals.shutdown(0);
  }

}

