Exemple #1
0
 public override Cmd VisitRE(RE node) {
   //Contract.Requires(node != null);
   Contract.Ensures(Contract.Result<Cmd>() != null);
   return base.VisitRE((RE)node.Clone());
 }
Exemple #2
0
 public virtual Cmd VisitRE(RE node) {
   Contract.Requires(node != null);
   Contract.Ensures(Contract.Result<Cmd>() != null);
   return (Cmd)this.Visit(node); // Call general visit so subtypes get visited by their particular visitor
 }
Exemple #3
0
    public static VCExpr RegExpr(RE r, VCExpr N, VCContext ctxt)
    {
      Contract.Requires(r != null);
      Contract.Requires(N != null);
      Contract.Requires(ctxt != null);
      Contract.Ensures(Contract.Result<VCExpr>() != null);

      if ( r is AtomicRE )
      {
        AtomicRE ar = (AtomicRE) r;
        return Block(ar.b, N, ctxt);
      }
      else if ( r is Sequential )
      {
        Sequential s = (Sequential) r;
        return RegExpr(s.first, RegExpr(s.second, N, ctxt), ctxt);
      }
      else if ( r is Choice )
      {
        Choice ch = (Choice) r;
        VCExpr res;
        if (ch.rs == null || ch.rs.Count==0) 
        {
          res = N;
        } 
        else 
        {
          VCExpr currentWLP = RegExpr(cce.NonNull(ch.rs[0]), N, ctxt);
          for (int i = 1, n = ch.rs.Count; i < n; i++)
          {
            currentWLP = ctxt.Ctxt.ExprGen.And(currentWLP, RegExpr(cce.NonNull(ch.rs[i]), N, ctxt));
          }
          res = currentWLP;
        }
        return res;
      }
      else
      {
        Contract.Assert(false);throw new cce.UnreachableException();  // unexpected RE subtype
      }
    }
Exemple #4
0
 public override Cmd VisitRE(RE node)
 {
     Contract.Ensures(Contract.Result<Cmd>() == node);
     return (Cmd)this.Visit(node); // Call general visit so subtypes get visited by their particular visitor
 }
Exemple #5
0
 public Sequential(RE a, RE b) {
   Contract.Requires(b != null);
   Contract.Requires(a != null);
   first = a;
   second = b;
 }