public void Test() { string str = "10 + 2 - 5 + 4 + 9"; Context context = new Context(str); AbstractExpression expression = new NonterminalExpression(); int result = expression.Interpret(context); Assert.AreEqual(30, result); }
static void Main(string[] args) { Context context = new Context { Vocabulary = 'a', Source = "aaa" }; var expression = new NonterminalExpression(); expression.Interpret(context); Console.WriteLine(context.Result); }