public void Interpret(Expr expression) { try { var value = Evaluate(expression); Console.WriteLine(Stringify(value)); } catch (RuntimeException e) { Lox.RuntimeError(e); } }
internal void AssignAt(int distance, Token name, object value) { Ancestor(distance).Match( some: env => env.values[name.Lexeme] = value, none: () => Lox.RuntimeError( new RuntimeError(name, $"Unable to assign to variable {name.Lexeme} value {value}") ) ); }
public void Interpret(List <Stmt> statements) { try { foreach (Stmt statement in statements) { Execute(statement); } } catch (RuntimeException error) { Lox.RuntimeError(error); } }
internal void Interpret(IEnumerable <Stmt> statments) { try { foreach (Stmt statement in statments) { Execute(statement); } } catch (RuntimeError error) { Lox.RuntimeError(error); } }
public void Interpret(IList <Stmt> statements) { try { foreach (var statement in statements) { Execute(statement); } } catch (RuntimeError error) { _lox.RuntimeError(error); } }