예제 #1
0
        private bool BoogieOnce(Bpl.Program boogieProgram)
        {
            if (boogieProgram.Resolve() == 0 && boogieProgram.Typecheck() == 0) { //FIXME ResolveAndTypecheck?
            ExecutionEngine.EliminateDeadVariables(boogieProgram);
            ExecutionEngine.CollectModSets(boogieProgram);
            ExecutionEngine.CoalesceBlocks(boogieProgram);
            ExecutionEngine.Inline(boogieProgram);

            //NOTE: We could capture errors instead of printing them (pass a delegate instead of null)
            switch (ExecutionEngine.InferAndVerify(boogieProgram, new PipelineStatistics(), "ServerProgram", null, DateTime.UtcNow.Ticks.ToString())) {
              case PipelineOutcome.Done:
              case PipelineOutcome.VerificationCompleted:
            return true;
            }
              }

              return false;
        }
예제 #2
0
        /// <summary>
        /// Resolves and type checks the given Boogie program.
        /// Returns:
        ///  - Done if no errors occurred, and command line specified no resolution or no type checking.
        ///  - ResolutionError if a resolution error occurred
        ///  - TypeCheckingError if a type checking error occurred
        ///  - ResolvedAndTypeChecked if both resolution and type checking succeeded
        /// </summary>
        static PipelineOutcome BoogieResolveAndTypecheck(Bpl.Program program)
        {
            Contract.Requires(program != null);
              // ---------- Resolve ------------------------------------------------------------
              int errorCount = program.Resolve();
              if (errorCount != 0) {
            return PipelineOutcome.ResolutionError;
              }

              // ---------- Type check ------------------------------------------------------------
              errorCount = program.Typecheck();
              if (errorCount != 0) {
            return PipelineOutcome.TypeCheckingError;
              }

              return PipelineOutcome.ResolvedAndTypeChecked;
        }