public List<Warning> Analyze(ProcessSystem system) { base.VisitParentBeforeChildren = false; //Backwards analysis _warnings = new List<Warning>(); this.Start(system); return _warnings; }
public ProcessStateVisualization(ProcessSystem ast, BaseFormatter formatter) { _ast = ast; _formatter = formatter; foreach (ProcessDefinition pd in _ast.ChildNodes) { _procConstants.Add(pd.Name, pd.Process); } }
public void Compile(List<TupleInfo> tuples, ProcessSystem processes, CompileOptions options) { this.processes = processes; this.processes.MeetTheParents(); this.tuples = tuples; this.processes.MainMethodStart += new CompileEventHandler(CompileTupleSpaces); PLRString.DisplayWithoutQuotes = true; //To make localities look right... processes.Compile(options); }
public List<Warning> Analyze(ProcessSystem system) { DateTime start = DateTime.Now; base.VisitParentBeforeChildren = false; _warnings = new List<Warning>(); this.Start(system); GeneratePossibleChannels(_inActions); GeneratePossibleChannels(_outActions); Match(_inActions, _outActions, "output"); Match(_outActions, _inActions, "input"); TimeSpan t = DateTime.Now.Subtract(start); //TODO: Measure on larger systems... //Console.WriteLine("Unmatched channels finished in {0}ms", t.TotalMilliseconds); return _warnings; }
public List<Warning> Analyze(ProcessSystem system) { _warnings = new List<Warning>(); foreach (ProcessDefinition def in system) { _procNames.Add(def.Name); } this.Start(system); foreach (string name in _procNames) { for (int i = system.ChildNodes.Count-1; i >= 0; i--) { ProcessDefinition def = (ProcessDefinition)system.ChildNodes[i]; if (def.Name == name && !def.EntryProc) { _warnings.Add(new Warning(def.LexicalInfo, "Process " + def.Name + " is never invoked in the system")); if (_removeUnused) { system.ChildNodes.Remove(def); } } } } return _warnings; }
public override void Visit(ProcessSystem sys) { List<string> children = PopChildren(); Return( @"\documentclass[a4paper,11pt]{article} \usepackage{amsmath} %<CCS commands> \newcommand{\defeq}{\ \stackrel{\mathrm{def}}{=}\ } \newcommand{\proc}[1]{\mathrm{#1}} \newcommand{\ccsdot}{\ \textbf{.}\ } %</CCS commands> \begin{document} \begin{align*} " + Join(" \\\\\n", children) + @" \end{align*} \end{document} "); }
private static void CheckPrintout(CompileOptions options, ProcessSystem system) { //Check whether we want to print out a formatted version of the source if (options["p"] != "") { string format = options["p"]; BaseFormatter formatter = null; if (format.ToLower() == "html") { formatter = new BaseFormatter(); } else if (format.ToLower() == "latex" || format.ToLower() == "tex") { format = "tex"; formatter = new LaTeXFormatter(); } else if (format.ToLower() == "txt" || format.ToLower() == "ccs") { format = "formatted_ccs"; //So we don't overwrite the original file... formatter = new BaseFormatter(); } else { DieIf(true, "Format for /print options must be one of ccs,html,latex"); } formatter.Start(system); string result = formatter.GetFormatted(); string filename = Path.ChangeExtension(options.OutputFile, format); File.WriteAllText(filename, result); Console.WriteLine("Formatted source written to {0}", filename); } }
//Root namespace nodes public virtual void Visit(ProcessSystem node) { }
public List<Warning> Analyze(ProcessSystem system) { this.Start(system); return new List<Warning>(); }
public override void Visit(ProcessSystem sys) { Return("<table>\n\t<tr>" + Join("</tr>\n\t<tr>", PopChildren()) + "\n\t</tr>\n</table>"); }
public List<Warning> Analyze(ProcessSystem system) { _warnings = new List<Warning>(); this.Start(system); return _warnings; }
public virtual string Format(ProcessSystem sys) { return Join("\n", sys); }
private void OpenAssembly(object sender, EventArgs e) { DialogResult result = openProcessExeDialog.ShowDialog(); if (result == DialogResult.OK) { try { _assembly = Assembly.Load(File.ReadAllBytes(openProcessExeDialog.FileName)); MethodInfo m = _assembly.GetModules(false)[0].GetMethod("Main"); if (m == null) { MessageBox.Show("Unable to open assembly " + openProcessExeDialog.FileName + ", it does not appear to have been compiled with the PLR!", "Failed to open assembly", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception) { MessageBox.Show("Unable to open assembly " + openProcessExeDialog.FileName + ", it does not appear to be a .NET assembly!", "Failed to open assembly", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } btnStart.Enabled = true; btnStartStep.Enabled = true; this.Text = "Process Viewer - " + openProcessExeDialog.FileName; ClearAll(); result = openProcessSourceDialog.ShowDialog(); _loadedSystem = null; _visual = null; txtProcessState.Text = ""; if (result == DialogResult.Cancel) { MessageBox.Show("No source file selected. Visualization of the current state of the system will not be available during execution", "No source file chosen", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (result == DialogResult.OK) { _sourceFile = openProcessSourceDialog.FileName; txtProcessState.Text = File.ReadAllText(_sourceFile); string ext = Path.GetExtension(_sourceFile).ToLower().Substring(1); if (!_parsers.ContainsKey(ext)) { ErrorMsg("No suitable parser found", "No parser is loaded that parses files of type \"" + ext + "\""); } else { _parser = _parsers[ext]; try { _loadedSystem = _parser.Parse(_sourceFile); FindUnsupportedNodes f = new FindUnsupportedNodes(); f.Start(_loadedSystem); if (f.typeName != "") { MessageBox.Show("Sorry, visualization are currently not supported for systems that use the class " + f.typeName + ", however, the application can be run without visualization!", "Cannot show visualization", MessageBoxButtons.OK, MessageBoxIcon.Warning); _loadedSystem = null; } } catch (ParseException pex) { ErrorMsg("Failed to parse source file", "Failed to parse source file " + _sourceFile + ", error: \n" + pex.Message); } } } } }