Package wyautl.io

Examples of wyautl.io.PrettyAutomataWriter


          process(module, stage);
        } catch (VerificationCheck.AssertionFailure ex) {
          // FIXME: this feels a bit like a hack.
          if(debug && ex.original() != null) {
            Rewriter rw = ex.rewriter();
            PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,SCHEMA,"Or","And");
            writer.write(ex.original());
            writer.flush();
            System.err.println("\n\n=> (" + rw.getStats() + ")\n");
            writer.write(ex.reduction());
            writer.flush();
          }
          syntaxError(ex.getMessage(), module.filename(),
              ex.assertion(), ex);
        } catch (SmtVerificationCheck.AssertionFailure e) {
                    syntaxError(e.getMessage(), module.filename(),
View Full Code Here


  }

  public static void debug(Automaton automaton) {
    try {
      // System.out.println(automaton);
      PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,
          SCHEMA, "Or", "And");
      writer.write(automaton);
      writer.flush();
    } catch(IOException e) {
      System.out.println("I/O Exception - " + e);
    }
  }
View Full Code Here

        try {
          FileInputStream fin = new FileInputStream(args.get(0));
          PrettyAutomataReader reader = new PrettyAutomataReader(fin,SCHEMA);
          Automaton automaton = reader.read();

          new PrettyAutomataWriter(System.err, SCHEMA, "And",
              "Or").write(automaton);
          IterativeRewriter.Strategy<InferenceRule> inferenceStrategy = new UnfairStateRuleRewriteStrategy<InferenceRule>(
              automaton, Solver.inferences, Solver.SCHEMA);
          IterativeRewriter.Strategy<ReductionRule> reductionStrategy = new UnfairStateRuleRewriteStrategy<ReductionRule>(
              automaton, Solver.reductions, Solver.SCHEMA);
          IterativeRewriter rw = new IterativeRewriter(automaton,
              inferenceStrategy, reductionStrategy, SCHEMA);
          rw.apply();
          System.err.println("\n\n=> (" + rw.getStats() + ")\n");
          new PrettyAutomataWriter(System.err, SCHEMA, "And",
              "Or").write(automaton);
          System.out.println();
          System.exit(0);
        } catch(IOException e) {
          System.err.println(e.getMessage());
View Full Code Here

      Parser parser = new Parser(text);
      Automaton automaton = new Automaton();
      int root = parser.parse(automaton);
      automaton.setRoot(0, root);

      PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,
          Arithmetic.SCHEMA, "Or", "And");
      System.out.println("------------------------------------");
      writer.write(automaton);
      writer.flush();

      StrategyRewriter.Strategy<InferenceRule> inferenceStrategy;
      StrategyRewriter.Strategy<ReductionRule> reductionStrategy;

      switch (rwMode) {
      case SIMPLE:
        inferenceStrategy = new SimpleRewriteStrategy<InferenceRule>(
            automaton, Arithmetic.inferences);
        reductionStrategy = new SimpleRewriteStrategy<ReductionRule>(
            automaton, Arithmetic.reductions);
        break;
      case STATIC_DISPATCH:
        inferenceStrategy = new StaticDispatchRewriteStrategy<InferenceRule>(
            automaton, Arithmetic.inferences,Arithmetic.SCHEMA);
        reductionStrategy = new StaticDispatchRewriteStrategy<ReductionRule>(
            automaton, Arithmetic.reductions,Arithmetic.SCHEMA);
        break;
      default:
        // DEAD-CODE
        inferenceStrategy = null;
        reductionStrategy = null;
      }
      StrategyRewriter rw = new StrategyRewriter(automaton,
          inferenceStrategy, reductionStrategy, Arithmetic.SCHEMA);
      rw.apply(10000);
      System.out.println("\n\n=> (" + rw.getStats() + ")\n");
      writer.write(automaton);
      writer.flush();
      System.out.println("\n");
    } catch (RuntimeException e) {
      // Catching runtime exceptions is actually rather bad style;
      // see lecture about Exceptions later in the course!
      System.err.println("error: " + e.getMessage());
View Full Code Here

      Parser parser = new Parser(text);
      Automaton automaton = new Automaton();
      int root = parser.parse(automaton);
      automaton.setRoot(0, root);

      PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,
                   Quantifiers.SCHEMA, "Or", "And");
      System.out.println("------------------------------------");
      writer.write(automaton);
      writer.flush();

      StrategyRewriter.Strategy<InferenceRule> inferenceStrategy;
    StrategyRewriter.Strategy<ReductionRule> reductionStrategy;

    switch (rwMode) {
    case SIMPLE:
      inferenceStrategy = new SimpleRewriteStrategy<InferenceRule>(
          automaton, Quantifiers.inferences);
      reductionStrategy = new SimpleRewriteStrategy<ReductionRule>(
          automaton, Quantifiers.reductions);
      break;
    case STATIC_DISPATCH:
      inferenceStrategy = new UnfairStateRuleRewriteStrategy<InferenceRule>(
          automaton, Quantifiers.inferences,Quantifiers.SCHEMA);
      reductionStrategy = new UnfairStateRuleRewriteStrategy<ReductionRule>(
          automaton, Quantifiers.reductions,Quantifiers.SCHEMA);
    case GLOBAL_DISPATCH:
      inferenceStrategy = new UnfairRuleStateRewriteStrategy<InferenceRule>(
          automaton, Quantifiers.inferences);
      reductionStrategy = new UnfairRuleStateRewriteStrategy<ReductionRule>(
          automaton, Quantifiers.reductions);
      break;
    default:
      // DEAD-CODE
      inferenceStrategy = null;
      reductionStrategy = null;
    }
    StrategyRewriter rw = new StrategyRewriter(automaton,
        inferenceStrategy, reductionStrategy, Quantifiers.SCHEMA);
    rw.apply(50,100000);
      System.out.println("\n\n=> (" + rw.getStats() + ")\n");
      writer.write(automaton);
      writer.flush();
      System.out.println("\n");
  } catch(RuntimeException e) {
      // Catching runtime exceptions is actually rather bad style;
      // see lecture about Exceptions later in the course!
      System.err.println("error: " + e.getMessage());
View Full Code Here

      Parser parser = new Parser(text);
      Automaton automaton = new Automaton();
      int root = parser.parse(automaton);
      automaton.setRoot(0, root);

      PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,
                   Closure.SCHEMA, "Or", "And");
      System.out.println("------------------------------------");
      writer.write(automaton);
      writer.flush();

      StrategyRewriter.Strategy<InferenceRule> inferenceStrategy;
    StrategyRewriter.Strategy<ReductionRule> reductionStrategy;

    switch (rwMode) {
    case SIMPLE:
      inferenceStrategy = new SimpleRewriteStrategy<InferenceRule>(
          automaton, Closure.inferences);
      reductionStrategy = new SimpleRewriteStrategy<ReductionRule>(
          automaton, Closure.reductions);
      break;
    case STATIC_DISPATCH:
      inferenceStrategy = new StaticDispatchRewriteStrategy<InferenceRule>(
          automaton, Closure.inferences,Closure.SCHEMA);
      reductionStrategy = new StaticDispatchRewriteStrategy<ReductionRule>(
          automaton, Closure.reductions,Closure.SCHEMA);
      break;
    default:
      // DEAD-CODE
      inferenceStrategy = null;
      reductionStrategy = null;
    }
    StrategyRewriter rw = new StrategyRewriter(automaton,
        inferenceStrategy, reductionStrategy, Closure.SCHEMA);
    rw.apply(10000);
      System.out.println("\n\n=> (" + rw.getStats() + ")\n");
      writer.write(automaton);
      writer.flush();
      System.out.println("\n");
  } catch(RuntimeException e) {
      // Catching runtime exceptions is actually rather bad style;
      // see lecture about Exceptions later in the course!
      System.err.println("error: " + e.getMessage());
View Full Code Here

      Parser parser = new Parser(text);
      Automaton automaton = new Automaton();
      int root = parser.parse(automaton);
      automaton.setRoot(0, root);

      PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,
          Logic.SCHEMA, "Or", "And");
      System.out.println("------------------------------------");
      writer.write(automaton);
      writer.flush();

      StrategyRewriter.Strategy<InferenceRule> inferenceStrategy;
      StrategyRewriter.Strategy<ReductionRule> reductionStrategy;

      switch (rwMode) {
      case SIMPLE:
        inferenceStrategy = new SimpleRewriteStrategy<InferenceRule>(
            automaton, Logic.inferences);
        reductionStrategy = new SimpleRewriteStrategy<ReductionRule>(
            automaton, Logic.reductions);
        break;
      case STATIC_DISPATCH:
        inferenceStrategy = new StaticDispatchRewriteStrategy<InferenceRule>(
            automaton, Logic.inferences,Logic.SCHEMA);
        reductionStrategy = new StaticDispatchRewriteStrategy<ReductionRule>(
            automaton, Logic.reductions,Logic.SCHEMA);
        break;
      default:
        // DEAD-CODE
        inferenceStrategy = null;
        reductionStrategy = null;
      }
      StrategyRewriter rw = new StrategyRewriter(automaton,
          inferenceStrategy, reductionStrategy, Logic.SCHEMA);
      rw.apply(10000);
      System.out.println("\n\n=> (" + rw.getStats() + ")\n");
      writer.write(automaton);
      writer.flush();
      System.out.println("\n");
  } catch(RuntimeException e) {
      // Catching runtime exceptions is actually rather bad style;
      // see lecture about Exceptions later in the course!
      System.err.println("error: " + e.getMessage());
View Full Code Here

      Parser parser = new Parser(text);
      Automaton automaton = new Automaton();
      int root = parser.parse(automaton);
      automaton.setRoot(0, root);

      PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,
                   Types.SCHEMA, "Or", "And");
      System.out.println("------------------------------------");
      writer.write(automaton);
      writer.flush();

      StrategyRewriter.Strategy<InferenceRule> inferenceStrategy;
    StrategyRewriter.Strategy<ReductionRule> reductionStrategy;

    switch (rwMode) {
    case SIMPLE:
      inferenceStrategy = new SimpleRewriteStrategy<InferenceRule>(
          automaton, Types.inferences);
      reductionStrategy = new SimpleRewriteStrategy<ReductionRule>(
          automaton, Types.reductions);
      break;
    case STATIC_DISPATCH:
      inferenceStrategy = new UnfairStateRuleRewriteStrategy<InferenceRule>(
          automaton, Types.inferences,Types.SCHEMA);
      reductionStrategy = new UnfairStateRuleRewriteStrategy<ReductionRule>(
          automaton, Types.reductions,Types.SCHEMA);
      break;
    default:
      // DEAD-CODE
      inferenceStrategy = null;
      reductionStrategy = null;
    }
    StrategyRewriter rw = new StrategyRewriter(automaton,
        inferenceStrategy, reductionStrategy, Types.SCHEMA);
    rw.apply(50,10000);
      System.out.println("\n\n=> (" + rw.getStats() + ")\n");
      writer.write(automaton);
      writer.flush();
      System.out.println("\n");
  } catch(RuntimeException e) {
      // Catching runtime exceptions is actually rather bad style;
      // see lecture about Exceptions later in the course!
      System.err.println("error: " + e.getMessage());
View Full Code Here

   * @param schema
   *            The schema for the automaton being printed.
   */
  public static void debug(Automaton automaton, Schema schema, String... indents) {
    try {
      PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,
          schema,indents);
      writer.write(automaton);
      writer.flush();
      System.out.println();
    } catch (IOException e) {
      System.err.println("I/O error printing automaton");
    }
  }
View Full Code Here

   * @param schema
   *            The schema for the automaton being printed.
   */
  public static void debug(int root, Automaton automaton, Schema schema) {
    try {
      PrettyAutomataWriter writer = new PrettyAutomataWriter(System.out,
          schema);
      writer.write(root,automaton);
      writer.flush();
      System.out.println();
    } catch (IOException e) {
      System.err.println("I/O error printing automaton");
    }

View Full Code Here

TOP

Related Classes of wyautl.io.PrettyAutomataWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.