private IEnumerable <string> GetSymbolsAsList(string f) { var physFile = new PhysicalFile { Filepath = f, Sourcecode = File.ReadAllText(f) }; var dtu = new DafnyTranslationUnit(physFile); var dafnyProg = dtu.Verify().DafnyProgram; ISymbolTableGenerator st = new SymbolTableGenerator(dafnyProg); ISymbolInformation root = st.GenerateSymbolTable(); ISymbolTableManager sm = new SymbolTableManager(root); ISymbolNavigator navigator = new SymbolNavigator(); List <ISymbolInformation> symbols = new List <ISymbolInformation>(); foreach (var modul in root.Children) { symbols.AddRange(navigator.TopDownAll(modul)); } var actual = symbols.Select(x => x.ToDebugString()).ToList(); Console.WriteLine("SymboleTable for " + f); Console.Write(((SymbolTableManager)sm).CreateDebugReadOut()); return(actual); }
/// <summary> /// Creates a <c>DafnyTranslationUnit</c> and calls the verification process for the physical file of this instance. /// Afterwards, the updated content gets verified. /// </summary> private void GenerateTranslationResult() { if (PhysicalFile == null) { throw new InvalidOperationException(Resources.ExceptionMessages.file_repo_must_have_physical); } DafnyTranslationUnit translationUnit = new DafnyTranslationUnit(PhysicalFile); Result = translationUnit.Verify(); }
private void RunCompilation(string filePath, string[] args = null) { if (args == null) { args = new string[] { }; } var physFile = new PhysicalFile() { Filepath = filePath, Sourcecode = File.ReadAllText(filePath), Uri = new Uri(filePath) }; ExecutionEngine.printer = new ConsolePrinter(); var results = new DafnyTranslationUnit(physFile).Verify(); var repo = new FileRepository(physFile, results); compilerResults = new CompileProvider(repo, args).Compile(); }