Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Context context = new Context
            {
                Vocabulary = 'a',
                Source     = "aaa"
            };

            var expression = new NonterminalExpression();

            expression.Interpret(context);
            Console.WriteLine(context.Result);
        }