public async void Run(CodeBlock.OutputFunction printF) { cBlock.SetDelegates(adder, getter); lExpr.SetDelegate(getter); while (lExpr.Evaluate().Type == Token_type.TRUE) { cBlock.Run(printF); } }
public void Run(CodeBlock.OutputFunction PrintF) { foreach (var item in statements) { item.SetDelegates(setVar, getVar); } foreach (var item in statements) { item.Run(PrintF); } }
private async void runToolStripMenuItem_Click(object sender, EventArgs e) { OutputTextbox.Clear(); await Task.Run(() => { CodeBlock.OutputFunction printF = OutputTextbox.AppendText; string sourceCode = inputTextBox.Text; Lexer lexer = null; Parser parser = null; try { lexer = new Lexer(sourceCode); } catch (Exception) { printF("Syntax error"); return; } try { parser = new Parser(lexer.GetList); } catch (Exception) { printF("Parsing error"); return; } try { parser.GetProgram().Run(printF); } catch (Exception) { printF("Runtime error"); return; } }); }
public void Run(CodeBlock.OutputFunction printF) { expr.SetDelegate(GetVar); AddVar(id, expr.Evaluate().Value, true); }
public void Run(CodeBlock.OutputFunction printF) { expr.SetDelegate(getVar); printF($"{expr.Evaluate().Value}\n"); }