/// <summary> /// Pipeline the boogie program to Dafny where it is valid /// </summary> /// <returns>Exit value</returns> public static PipelineOutcome BoogiePipeline(Bpl.Program program, IList <string> fileNames, string programId, ErrorReporterDelegate er, out PipelineStatistics stats, out List <ErrorInformation> errorList, Program tmpDafnyProgram = null) { Contract.Requires(program != null); Contract.Ensures(0 <= Contract.ValueAtReturn(out stats).InconclusiveCount&& 0 <= Contract.ValueAtReturn(out stats).TimeoutCount); LinearTypeChecker ltc; CivlTypeChecker ctc; string baseName = cce.NonNull(Path.GetFileName(fileNames[fileNames.Count - 1])); baseName = cce.NonNull(Path.ChangeExtension(baseName, "bpl")); string bplFileName = Path.Combine(Path.GetTempPath(), baseName); errorList = new List <ErrorInformation>(); stats = new PipelineStatistics(); PipelineOutcome oc = ExecutionEngine.ResolveAndTypecheck(program, bplFileName, out ltc, out ctc); switch (oc) { case PipelineOutcome.ResolvedAndTypeChecked: ExecutionEngine.EliminateDeadVariables(program); ExecutionEngine.CollectModSets(program); ExecutionEngine.CoalesceBlocks(program); ExecutionEngine.Inline(program); errorList = new List <ErrorInformation>(); var tmp = new List <ErrorInformation>(); oc = ExecutionEngine.InferAndVerify(program, stats, programId, errorInfo => { tmp.Add(errorInfo); er?.Invoke(new CompoundErrorInformation(errorInfo.Tok, errorInfo.Msg, errorInfo, tmpDafnyProgram)); }); errorList.AddRange(tmp); return(oc); default: Contract.Assert(false); throw new cce.UnreachableException(); // unexpected outcome } }
internal static VerifyResult VerifyState(ProofState state, ErrorReporterDelegate er) { if (_proofList == null) { _proofList = new List <ProofState>(); } if (_proofList.Count + 1 < SolutionCounter) { _proofList.Add(state); return(VerifyResult.Cached); } else { _proofList.Add(state); var bodyList = new Dictionary <ProofState, BlockStmt>(); foreach (var proofState in _proofList) { bodyList.Add(proofState, Util.InsertCode(proofState, new Dictionary <UpdateStmt, List <Statement> >() { { proofState.TacticApplication, proofState.GetGeneratedCode() } })); } var memberList = Util.GenerateMembers(state, bodyList); var prog = Util.GenerateDafnyProgram(state, memberList.Values.ToList()); var result = Util.ResolveAndVerify(prog, errorInfo => { er?.Invoke(new CompoundErrorInformation(errorInfo.Tok, errorInfo.Msg, errorInfo, state)); }); if (result.Count == 0) { return(VerifyResult.Verified); } else { //TODO: find which proof state verified (if any) //TODO: update verification results // er(); return(VerifyResult.Failed); } } }
private void ReportError(ParserErrorKinds errorKind, string hint) { HasErrors = true; _errorReporter?.Invoke(errorKind, hint); }