public static string Eval(string input) { var expression = Expression.Parse(input); var state = new ForthState(); foreach (var definition in expression) { definition.Evaluate(state); } return(state.ToString()); }
public static string Evaluate(string[] instructions) { var state = new ForthState(); foreach (var instruction in instructions) { var expression = Expression.Parse(instruction); foreach (var definition in expression) { definition.Evaluate(state); } } return(state.ToString()); }