public void RunGalaxy() { var declarations = File.ReadAllLines("galaxy.txt"); var main = "ap galaxy ap ap cons 0 146"; var executor = new ProgramExecutor(); var result = executor.Execute(main, declarations); TestContext.Progress.WriteLine(result.PrettyPrint()); }
public void Test() { var add4 = "add4 = ap add ap add ap add ap add 4"; var main = "ap add4 8 5 5 5 5 5 3 3 3"; var fff = "fff = ap t fff"; var main1 = "ap fff 42"; var executor = new ProgramExecutor(); var result = executor.Execute(main, add4); //var result = executor.Execute(main1, fff);N Console.WriteLine(result.PrettyPrint()); Console.WriteLine(result.Print()); Console.WriteLine(AstReducer.ReducesCount); }
private static string BuildAndRun(string filePath) { ILLanguage backend = new CecilBackendLanguage(filePath); using (var interpreter = new Interpreter <ILLanguage>(backend)) using (var source = new StreamReader(filePath)) { if (!interpreter.Parse(source, filePath)) { throw new AssertionException("Parsing of file " + filePath + " failed!"); } } backend.Save(); return(ProgramExecutor.Execute(Path.GetFileNameWithoutExtension(filePath) + ".exe")); }
private void FillListBoxMenu(ICollection <MenuItemModel> cMenu) { var menuRun = new MenuItemModel(LocaleConstants.ACTION_RUNPROGRAM, LocaleConstants.ACTION_RUNPROGRAM, 10); menuRun.Command = new DelegateCommand((state) => { executor.Execute(selectedItem, 0); }); menuRun.Icon.Source = ImageToBitmapSourceConverter.Convert(ResourceIcons.IconRun); cMenu.Add(menuRun); var menuAdd = new MenuItemModel(LocaleConstants.ACTION_ADDPROGRAM, LocaleConstants.ACTION_ADDPROGRAM, 10); menuAdd.Icon.Source = ImageToBitmapSourceConverter.Convert(ResourceIcons.IconAdd); cMenu.Add(menuAdd); var menuRemove = new MenuItemModel(LocaleConstants.ACTION_REMOVEPROGRAM, LocaleConstants.ACTION_REMOVEPROGRAM, 10); menuRemove.Icon.Source = ImageToBitmapSourceConverter.Convert(ResourceIcons.IconDelete); cMenu.Add(menuRemove); }