public LanguageRepl(bool shouldShowTree, bool shouldShowProgram, bool isMultiLine, bool shouldEvaluate) : base(isMultiLine) { showTree = shouldShowTree; showProgram = shouldShowProgram; evaluate = shouldEvaluate; environment = new BindingEnvironment(false); }
public void Evaluate(BindingEnvironment env, Dictionary <VariableSymbol, object> variables) { var res = env.CurrentInterpretation.Evaluate(variables); if (res.Diagnostics.Any()) { PrintDiagnostic(res.Diagnostics); } else if (evaluate && res.Value != null) { Console.WriteLine(res.Value, DEFAULT_COLOR); } }
public static void Evaluate(BindingEnvironment env, Dictionary <VariableSymbol, object> variables) { var res = env.CurrentInterpretation.Evaluate(variables); if (res.Diagnostics.Any()) { foreach (var diagnostic in res.Diagnostics) { Console.WriteLine(diagnostic); } } else { Console.WriteLine(res.Value); } }
public object Evaluate(BindingEnvironment environment) { return(this.value); }
public void Execute(BindingEnvironment environment) { environment.SetValue(this.name, this.expression.Evaluate(environment)); }
public object Evaluate(BindingEnvironment environment) { return(environment.GetValue(this.name)); }