OK, the parser now looks more decent.
[repair.git] / Repair / RepairCompiler / MCC / Compiler.java
index 1c0d7e1a3174b56e39aa45cfe19dce680b4443b5..949ae871de523e77747cb6a0de9974fba63e9e6a 100755 (executable)
@@ -17,6 +17,7 @@ import MCC.IR.*;
  */
 
 public class Compiler {
+    /* Set this flag to false to turn repairs off */
     public static boolean REPAIR=true;
     
     public static void main(String[] args) {
@@ -38,7 +39,7 @@ public class Compiler {
          * specified at command line
          */
 
-        System.out.println("\nMCC v0.0.1 - MIT LCS (Author: Daniel Roy, Brian Demsky)");
+        System.out.println("MCC v0.0.1 - MIT LCS (Author: Daniel Roy, Brian Demsky)\n");
 
        if (cli.infile == null) {
            System.err.println("\nError: no input file specified");
@@ -56,11 +57,10 @@ public class Compiler {
 
 
            Termination termination=null;
-           if (REPAIR) {
-               /* Check partition constraints */
-               (new ImplicitSchema(state)).update();
-               termination=new Termination(state);
-           }
+           /* Check partition constraints */
+           (new ImplicitSchema(state)).update();
+           termination=new Termination(state);
+
             state.printall();
             (new DependencyBuilder(state)).calculate();
             
@@ -91,17 +91,19 @@ public class Compiler {
                 //(new Optimizer(state)).optimize();
 
 
-               if(REPAIR) {
-                   FileOutputStream gcode2 = new FileOutputStream(cli.infile + "_aux.cc");
-                   FileOutputStream gcode3 = new FileOutputStream(cli.infile + "_aux.h");
-                   RepairGenerator wg = new RepairGenerator(state,termination);
-                   wg.generate(gcode,gcode2,gcode3, cli.infile + "_aux.h");
-                   gcode2.close();
-                   gcode3.close();
-               } else {
+
+               FileOutputStream gcode2 = new FileOutputStream(cli.infile + "_aux.cc");
+               FileOutputStream gcode3 = new FileOutputStream(cli.infile + "_aux.h");
+               RepairGenerator wg = new RepairGenerator(state,termination);
+               wg.generate(gcode,gcode2,gcode3, cli.infile + "_aux.h");
+               gcode2.close();
+               gcode3.close();
+               /*              } else {
                    WorklistGenerator ng = new WorklistGenerator(state);
+                   SetInclusion.worklist=true;
+                   RelationInclusion.worklist=true;
                    ng.generate(gcode);
-               }
+                   }*/
                 gcode.close();
             } catch (Exception e) {
                 e.printStackTrace();
@@ -247,6 +249,7 @@ public class Compiler {
             LineCount.reset();
             FileInputStream infile = new FileInputStream(state.infile + ".struct");
             TDLParser parser = new TDLParser(new Lexer(infile));
+           parser.filename = state.infile + ".struct";
             CUP$TDLParser$actions.debug = state.verbose > 1 ;
             state.ptStructures = (ParseNode) parser.parse().value;
         } catch (FileNotFoundException fnfe) {
@@ -264,6 +267,7 @@ public class Compiler {
             LineCount.reset();
             FileInputStream infile = new FileInputStream(state.infile + ".model");
             MDLParser parser = new MDLParser(new Lexer(infile));
+           parser.filename = state.infile + ".model";
             CUP$MDLParser$actions.debug = state.verbose > 1 ;
             state.ptModel = (ParseNode) parser.parse().value;
         } catch (FileNotFoundException fnfe) {
@@ -281,14 +285,15 @@ public class Compiler {
             LineCount.reset();
             FileInputStream infile = new FileInputStream(state.infile + ".space");
             SDLParser parser = new SDLParser(new Lexer(infile));
+           parser.filename = state.infile + ".space";
             CUP$SDLParser$actions.debug = state.verbose > 1 ;
             state.ptSpace = (ParseNode) parser.parse().value;
         } catch (FileNotFoundException fnfe) {
             System.err.println("Unable to open file: " + state.infile + ".space");
             System.exit(-1);
        } catch (Exception e) {
-           //      System.out.println(e);
-           //      e.printStackTrace();
+           System.out.println(e);
+           e.printStackTrace();
            return false;
        }
 
@@ -298,6 +303,7 @@ public class Compiler {
             LineCount.reset();
             FileInputStream infile = new FileInputStream(state.infile + ".constraints");
             CDLParser parser = new CDLParser(new Lexer(infile));
+           parser.filename = state.infile + ".constraints";
             CUP$CDLParser$actions.debug = state.verbose > 1 ;
             state.ptConstraints = (ParseNode) parser.parse().value;
         } catch (FileNotFoundException fnfe) {