Example #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;
 }
Example #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);
            }
        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);
            }
        }
Example #4
0
 public void add(string name, BoundVariable v)
 {
     contextStack.Peek().variables.Add(name, v);
 }