Package wycs.core

Examples of wycs.core.SemanticType$Atom


      }
    } else {
      TypePattern.Leaf lp = (TypePattern.Leaf) pattern;

      if (lp.var != null) {
        SemanticType type = builder.convert(pattern.toSyntacticType(),
            generics, context);
        environment.put(lp.var.name, type);
      }
    }
View Full Code Here


    return environment;
  }

  private void propagate(WyalFile.Assert s) {
    HashMap<String,SemanticType> environment = new HashMap<String,SemanticType>();
    SemanticType t = propagate(s.expr, environment, new HashSet<String>(), s);
    checkIsSubtype(SemanticType.Bool,t, s.expr);
  }
View Full Code Here

   * @return
   */
  private SemanticType propagate(Expr e,
      HashMap<String, SemanticType> environment,
      HashSet<String> generics, WyalFile.Context context) {
    SemanticType t;
    if(e instanceof Expr.Variable) {
      t = propagate((Expr.Variable)e, environment, generics, context);
    } else if(e instanceof Expr.Constant) {
      t = propagate((Expr.Constant)e, environment, generics, context);
    } else if(e instanceof Expr.Unary) {
View Full Code Here

  }

  private SemanticType propagate(Expr.Variable e,
      HashMap<String, SemanticType> environment,
      HashSet<String> generics, WyalFile.Context context) {
    SemanticType t = environment.get(e.name);
    if(t == null) {
      internalFailure("undeclared variable encountered (" + e + ")",
          filename, e);
    }
    return t;
View Full Code Here

  }

  private SemanticType propagate(Expr.Unary e,
      HashMap<String, SemanticType> environment,
      HashSet<String> generics, WyalFile.Context context) {
    SemanticType op_type = propagate(e.operand,environment,generics,context);

    switch(e.op) {
    case NOT:
      checkIsSubtype(SemanticType.Bool,op_type,e);
      break;
View Full Code Here

  }

  private SemanticType propagate(Expr.IndexOf e,
      HashMap<String, SemanticType> environment,
      HashSet<String> generics, WyalFile.Context context) {
    SemanticType src_type = propagate(e.operand, environment, generics,
        context);
    SemanticType index_type = propagate(e.index, environment, generics,
        context);
    if(src_type instanceof SemanticType.EffectiveTuple) {
      SemanticType.EffectiveTuple tt = (SemanticType.EffectiveTuple) src_type;
      checkIsSubtype(SemanticType.Int, index_type, e.operand);
      if (!(e.index instanceof Expr.Constant)) {
View Full Code Here

  }

  private SemanticType propagate(Expr.Binary e,
      HashMap<String, SemanticType> environment,
      HashSet<String> generics, WyalFile.Context context) {
    SemanticType lhs_type = propagate(e.leftOperand,environment,generics,context);
    SemanticType rhs_type = propagate(e.rightOperand,environment,generics,context);

    if (e.op != Expr.Binary.Op.IN
        && SemanticType.And(lhs_type, rhs_type) instanceof SemanticType.Void) {
      // This is useful to sanity check that the operands make sense. For
      // example, the expression "1.0 == 1" does not yield an automaton
View Full Code Here

  }

  private SemanticType propagate(Expr.Ternary e,
      HashMap<String, SemanticType> environment,
      HashSet<String> generics, WyalFile.Context context) {
    SemanticType firstType = propagate(e.firstOperand,environment,generics,context);
    SemanticType secondType = propagate(e.secondOperand,environment,generics,context);
    SemanticType thirdType = propagate(e.thirdOperand,environment,generics,context);
    switch(e.op) {
    case UPDATE:
      checkIsSubtype(SemanticType.SetTupleAnyAny,firstType,e.firstOperand);
      // FIXME: should this handle map updates?
      checkIsSubtype(SemanticType.Int, secondType, e.secondOperand);
View Full Code Here

      HashMap<String, SemanticType> environment,
      HashSet<String> generics, WyalFile.Context context) {
    environment = new HashMap<String,SemanticType>(environment);

    propagate(e.pattern,environment,generics,context);
    SemanticType r = propagate(e.operand,environment,generics,context);
    checkIsSubtype(SemanticType.Bool,r,e.operand);

    return SemanticType.Bool;
  }
View Full Code Here

  }

  private void propagate(TypePattern pattern,
      HashMap<String, SemanticType> environment,
      HashSet<String> generics, WyalFile.Context context) {
    SemanticType type = builder.convert(pattern.toSyntacticType(),
        generics, context);

    if (pattern instanceof TypePattern.Tuple) {
      TypePattern.Tuple tt = (TypePattern.Tuple) pattern;
      for (TypePattern p : tt.elements) {
View Full Code Here

TOP

Related Classes of wycs.core.SemanticType$Atom

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.