public void TestMedium() { var f = Files.pf_large3; var l = new LargeFileGenerator(1_000, 1986); l.Generate(); l.Store(f); var stopwatch = new Stopwatch(); stopwatch.Start(); Client.TextDocument.DidOpen(f, "dfy"); CompilerParams p = new CompilerParams { CompilationArguments = new string[] { }, FileToCompile = f }; CancellationSource.CancelAfter(TimeSpan.FromMinutes(1)); Client.SendRequest <CompilerResults>("compile", p, CancellationSource.Token).Wait(); stopwatch.Stop(); var elapsed_time = stopwatch.ElapsedMilliseconds; Console.WriteLine($"Performancetest 2 with 1'000 LOC took {elapsed_time}ms"); Assert.Less(elapsed_time, 60e3, "Runtime takes too long! Was: " + elapsed_time); }
public static void Compile( [Required(Description = "path to Shakespeare source code to compile")] string filename, [Optional("C", "c", Description = "Code generator: 'C' for C code, 'CS' for C#, 'I' for MSIL/EXE")] string compiler, [Optional(true, Description = "Include Debug information in MSIL")] bool debug ) { Console.WriteLine("ShakesCL - Command-line compiler interface for Shakespeare programming lanaguage"); Console.WriteLine("Copyright 2013, James M. Curran, Novel Theory Software"); var comp = CompilerLoader.Load(compiler); var grammar = new ShakespeareGrammar(comp); var parser = new Parser(grammar); var text = File.ReadAllText(filename); var tree = parser.Parse(text, filename); var app = new ScriptApp(parser.Language); var thread = new ScriptThread(app); var param = new CompilerParams() { OutFolder = @"C:\Users\User\Projects\Shakespeare\Executables\Debug\", SrcFileName = filename, Debug = debug }; comp.PrepareScope(thread, param); var output = (tree.Root.AstNode as AstNode).Evaluate(thread); Console.WriteLine(output); }
public async Task <CompilerResults> Handle(CompilerParams request, CancellationToken cancellationToken) { _log.LogInformation(string.Format(Resources.LoggingMessages.request_handle, _method)); try { IFileRepository f = _workspaceManager.GetFileRepository(request.FileToCompile); string[] args = request.CompilationArguments; ICompileProvider provider = new CompileProvider(f, args); return(await Task.Run(() => provider.Compile(), cancellationToken)); } catch (Exception e) { HandleError(string.Format(Resources.LoggingMessages.request_error, _method), e); return(null); } }
protected void RunCompilation(string testfile, string[] args = null) { if (args == null) { args = new string[] { }; } CompilerParams compilerParams = new CompilerParams { FileToCompile = testfile, CompilationArguments = args }; Client.TextDocument.DidOpen(testfile, "dfy"); compilerResults = Client.SendRequest <CompilerResults>(compileKeyword, compilerParams, CancellationSource.Token).Result; PrintResults(); }