Package wycs.core

Examples of wycs.core.WycsFile$Macro


        // We need to do this as MVEL doesn't recognise "modify"
        MacroProcessor macroProcessor = new MacroProcessor();
        Map<String, Macro> macros = new HashMap<String, Macro>(MVELConsequenceBuilder.macros);
        macros.put("modify",
                new Macro() {
                    public String doMacro() {
                        return "with  ";
                    }
                });
        macroProcessor.setMacros(macros);
View Full Code Here


        // We need to do this as MVEL doesn't recognise "modify"
        MacroProcessor macroProcessor = new MacroProcessor();
        Map macros = new HashMap(MVELConsequenceBuilder.macros);
        macros.put("modify",
                new Macro() {
                    public String doMacro() {
                        return "with  ";
                    }
                });
        macroProcessor.setMacros(macros);
View Full Code Here

        // We need to do this as MVEL doesn't recognise "modify"
        MacroProcessor macroProcessor = new MacroProcessor();
        Map<String, Macro> macros = new HashMap<String, Macro>(MVELConsequenceBuilder.macros);
        macros.put("modify",
                new Macro() {
                    public String doMacro() {
                        return "with  ";
                    }
                });
        macroProcessor.setMacros(macros);
View Full Code Here

        // We need to do this as MVEL doesn't recognise "modify"
        MacroProcessor macroProcessor = new MacroProcessor();
        Map<String, Macro> macros = new HashMap<String, Macro>(MVELConsequenceBuilder.macros);
        macros.put("modify",
                new Macro() {
                    public String doMacro() {
                        return "with  ";
                    }
                });
        macroProcessor.setMacros(macros);
View Full Code Here

       
        // We need to do this as MVEL doesn't recognise "modify"
        MacroProcessor macroProcessor = new MacroProcessor();
        Map macros = new HashMap( MVELConsequenceBuilder.macros );
        macros.put( "modify",
                    new Macro() {
                        public String doMacro() {
                            return "with  ";
                        }
                    } );
        macroProcessor.setMacros( macros );
View Full Code Here

        // We need to do this as MVEL doesn't recognise "modify"
        MacroProcessor macroProcessor = new MacroProcessor();
        Map<String, Macro> macros = new HashMap<String, Macro>(MVELConsequenceBuilder.macros);
        macros.put("modify",
                new Macro() {
                    public String doMacro() {
                        return "with  ";
                    }
                });
        macroProcessor.setMacros(macros);
View Full Code Here

        // We need to do this as MVEL doesn't recognise "modify"
        MacroProcessor macroProcessor = new MacroProcessor();
        Map<String, Macro> macros = new HashMap<String, Macro>(MVELConsequenceBuilder.macros);
        macros.put("modify",
                new Macro() {
                    public String doMacro() {
                        return "with  ";
                    }
                });
        macroProcessor.setMacros(macros);
View Full Code Here

      if (src.contentType() == WycsFile.ContentType) {
        Path.Entry<WycsFile> sf = (Path.Entry<WycsFile>) src;
        Path.Entry<WyalFile> df = (Path.Entry<WyalFile>) dst.create(
            sf.id(), WyalFile.ContentType);
        generatedFiles.add(df);
        WycsFile wf = sf.read();
        // NOTE: following is really a temporary hack
        new WycsFilePrinter(System.err).write(wf);
        WyalFile waf = decompile(wf);
        df.write(waf);
        count++;
View Full Code Here

        // i.e. abs(int x) => int y: x >= 0 ==> y > 0
        // Has the declaration: abs(int) => int
        // and the assertion: forall (r1 int) . r1 >= 0 ==> abs(r1) > 0
        // (note: functions have the return value numbered as 0, so the parameters start from 1)

        WycsFile module = null;
        try {
            module = builder.getModule(code.nid.module());
        } catch (Exception e) {
            internalFailure(e.getMessage(), wycsFile.filename(), code, e);
        }

        if (module == null) {
            throw new InternalError("module '" + code.nid.module() + "' not found");
        }

        WycsFile.Declaration decl = module.declaration(code.nid.name());

        if (decl == null) {
            throw new InternalError(
                    "function call to a non-declared function (name=" + code.nid.name() + ")");
        }
View Full Code Here

      if (src.contentType() == WyalFile.ContentType) {
        Path.Entry<WyalFile> source = (Path.Entry<WyalFile>) src;
        Path.Entry<WycsFile> target = (Path.Entry<WycsFile>) dst.create(src.id(),WycsFile.ContentType);
        generatedFiles.add(target);
        WyalFile wf = source.read();
        WycsFile wycs = getModuleStub(wf);
        target.write(wycs);
      }
    }
    logger.logTimedMessage("Generated stubs for " + count + " source file(s).",
        System.currentTimeMillis() - tmpTime, tmpMem - runtime.freeMemory());

    // ========================================================================
    // Type source files
    // ========================================================================
    runtime = Runtime.getRuntime();
    tmpTime = System.currentTimeMillis();
    tmpMem = runtime.freeMemory();

    TypePropagation typer = new TypePropagation(this);
    for(Pair<Path.Entry<?>,Path.Root> p : delta) {
      Path.Entry<?> f = p.first();
      if (f.contentType() == WyalFile.ContentType) {
        Path.Entry<WyalFile> sf = (Path.Entry<WyalFile>) f;
        WyalFile wf = sf.read();
        typer.apply(wf);
      }
    }

    logger.logTimedMessage("Typed " + count + " source file(s).",
        System.currentTimeMillis() - tmpTime, tmpMem - runtime.freeMemory());


    // ========================================================================
    // Code Generation
    // ========================================================================
    runtime = Runtime.getRuntime();
    tmpTime = System.currentTimeMillis();
    tmpMem = runtime.freeMemory();

    CodeGeneration generator = new CodeGeneration(this);
    for (Pair<Path.Entry<?>, Path.Root> p : delta) {
      Path.Entry<?> src = p.first();
      Path.Root dst = p.second();
      if (src.contentType() == WyalFile.ContentType) {
        Path.Entry<WyalFile> source = (Path.Entry<WyalFile>) src;
        Path.Entry<WycsFile> target = (Path.Entry<WycsFile>) dst
            .create(src.id(), WycsFile.ContentType);
        WyalFile wf = source.read();
        WycsFile wycs = generator.generate(wf);
        target.write(wycs);
      }
    }

    logger.logTimedMessage("Generated code for " + count + " source file(s).",
          System.currentTimeMillis() - tmpTime, tmpMem - runtime.freeMemory());

    // ========================================================================
    // Pipeline Stages
    // ========================================================================

    for (Transform<WycsFile> stage : pipeline) {
      for (Pair<Path.Entry<?>, Path.Root> p : delta) {
        Path.Root dst = p.second();
        Path.Entry<WycsFile> df = dst.get(p.first().id(),WycsFile.ContentType);
        WycsFile module = df.read();
        try {
          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(),
                            e.getAssertion(), e);
                }
      }
    }
View Full Code Here

TOP

Related Classes of wycs.core.WycsFile$Macro

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.