Package wycs.core

Examples of wycs.core.WycsFile$Macro


      throws ResolveError {

    for (WyalFile.Import imp : context.imports()) {
      for (Path.ID id : imports(imp.filter)) {
        try {
          WycsFile wf = getModule(id);
          if(wf == null) { continue; }
          T d = wf.declaration(name, type);
          if (d != null) {
            return new Pair<NameID, T>(new NameID(id, name), d);
          }
        } catch(SyntaxError e) {
          throw e;
View Full Code Here


        declarations.add(new WycsFile.Function(fun.name, type, null,
            fun.attribute(Attribute.Source.class)));
      }
    }

    return new WycsFile(wyalFile.id(), wyalFile.filename(), declarations);
  }
View Full Code Here

  }

  private Code transform(Code.FunCall e) {
    Code r = e;
    try {
      WycsFile module = builder.getModule(e.nid.module());
      // In principle, module should not be null if TypePropagation has
      // already passed. However, in the case of a function call inserted
      // during code generation, there is no guarantee that it was
      // previously resolved. This can cause problems if the standard
      // library is not on the path as e.g. x[i] is translated into
      // a call to wycs.core.Map.IndexOf().
      if(module == null) {
        internalFailure("cannot resolve as module: " + e.nid.module(), filename, e);
      }
      Object d = module.declaration(e.nid.name());
      if(d instanceof WycsFile.Function) {
        // Do nothing, since functions are not expanded like macros.
        // Instead, their axioms may be instantiated later either before
        // or during rewriting.
      } else if (d instanceof WycsFile.Macro) {
View Full Code Here

  }

  public static void debug(Code code, String filename) {
    ArrayList<WycsFile.Declaration> tmpDecls = new ArrayList();
    tmpDecls.add(new WycsFile.Assert("", code));
    WycsFile tmp = new WycsFile(Trie.ROOT, filename, tmpDecls);
    try {
      new WycsFilePrinter(System.err).write(tmp);
    } catch (IOException e) {
    }
  }
View Full Code Here

  }

  private Code instantiateAxioms(Code.FunCall condition, int freeVariable) {
    ArrayList<Code> axioms = new ArrayList<Code>();
    try {
      WycsFile module = builder.getModule(condition.nid.module());
      // module should not be null if TypePropagation has already passed.
      Object d = module.declaration(condition.nid.name());
      if(d instanceof WycsFile.Function) {
        WycsFile.Function fn = (WycsFile.Function) d;
        if(fn.constraint != null) {
          // There are some axioms we can instantiate. First, we need to
          // construct the generic binding for this function.
View Full Code Here

  private void instantiateFromExpression(Code.FunCall expression, ArrayList<Code> axioms, int freeVariable) {
    instantiateFromExpression(expression.operands[0], axioms, freeVariable);

    try {
      WycsFile module = builder.getModule(expression.nid.module());
      // module should not be null if TypePropagation has already passed.
      WycsFile.Function fn = module.declaration(expression.nid.name(),
          WycsFile.Function.class);
      if (fn.constraint != null) {
        // There are some axioms we can instantiate. First, we need to
        // construct the generic binding for this function.
        HashMap<String, SemanticType> generics = buildGenericBinding(
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.