예제 #1
0
 //////////////////////////////////////////////
 public BoogieBoundVariableExpression(IdentifierExpr boogieExpression, BoundVariable variable)
     : base(variable)
 {
     Debug.Assert(boogieExpression != null);
     Debug.Assert(boogieExpression.Decl is Microsoft.Boogie.BoundVariable || boogieExpression.Decl is Formal);
     boogieIdentifierExpression = boogieExpression;
 }
예제 #2
0
            public BoundVariable lookupVariable(string name)
            {
                int           i      = contextStack.Count;
                BoundVariable result = null;

                foreach (var f in contextStack)
                {
                    if (f.variables.TryGetValue(name, out result))
                    {
                        return(result);
                    }
                }
                return(null);
            }
예제 #3
0
        private void addFunctionBodies()
        {
            var ef = new ExpressionFactory(program);

            foreach (var d in boogieProgram.TopLevelDeclarations)
            {
                var t = d as Function;
                if (t == null)
                {
                    continue;
                }
                if (t.Body == null)
                {
                    continue;
                }

                FunctionTemplate template = program.findFunctionTemplate(t.Name);
                var arguments             = new BoundVariable[template.signature.argumentTypes.Count()];
                for (int i = 0; i < arguments.Length; i++)
                {
                    arguments[i] = program.makeFreshBoundVariable(t.InParams[i].Name,
                                                                  template.signature.argumentTypes[i]);
                }
//                Debug.Assert(template.body != null);

                var context = new TypeFactory.Context();
                context.push();
                foreach (var tp in template.typeParameters)
                {
                    context.add(tp);
                }
                for (int i = 0; i < arguments.Length; i++)
                {
                    context.add(t.InParams[i].Name, arguments[i]);
                }

                Expression expression = ef.makeExpression(t.Body, context, false);
                template.body = new FunctionBody(arguments, expression);
            }
        }
예제 #4
0
 public void add(string name, BoundVariable v)
 {
     contextStack.Peek().variables.Add(name, v);
 }