public static string Parse(IList <DafnyFile> files, string programName, ErrorReporter reporter, out Program program) { Contract.Requires(programName != null); Contract.Requires(files != null); program = null; ModuleDecl module = new LiteralModuleDecl(new DefaultModuleDecl(), null); BuiltIns builtIns = new BuiltIns(); foreach (DafnyFile dafnyFile in files) { Contract.Assert(dafnyFile != null); if (Bpl.CommandLineOptions.Clo.XmlSink != null && Bpl.CommandLineOptions.Clo.XmlSink.IsOpen && !dafnyFile.UseStdin) { Bpl.CommandLineOptions.Clo.XmlSink.WriteFileFragment(dafnyFile.FilePath); } if (Bpl.CommandLineOptions.Clo.Trace) { Console.WriteLine("Parsing " + dafnyFile.FilePath); } string err = ParseFile(dafnyFile, null, module, builtIns, new Errors(reporter), !dafnyFile.isPrecompiled, !dafnyFile.isPrecompiled); if (err != null) { return(err); } } if (!(DafnyOptions.O.DisallowIncludes || DafnyOptions.O.PrintIncludesMode == DafnyOptions.IncludesModes.Immediate)) { string errString = ParseIncludes(module, builtIns, DafnyFile.fileNames(files), new Errors(reporter)); if (errString != null) { return(errString); } } if (DafnyOptions.O.PrintIncludesMode == DafnyOptions.IncludesModes.Immediate) { DependencyMap dmap = new DependencyMap(); dmap.AddIncludes(((LiteralModuleDecl)module).ModuleDef.Includes); dmap.PrintMap(); } program = new Program(programName, module, builtIns, reporter); MaybePrintProgram(program, DafnyOptions.O.DafnyPrintFile, false); return(null); // success }