Example #1
0
        private static void ParserTest()
        {
            // (2 + 3) * (1 - 2)
            string expression = "2 3 + 1 - 2 *";

            var parser = new Parser();

            int result = parser.Evaluate(expression);

            Console.WriteLine($"{expression} = {result}");
        }
        private static void ParserTest()
        {
            // (2 + 3) * (1 - 2)
            string expression = "2 3 + 1 2 - *";    // odwrotna notacja polska

            var parser = new Parser(new ExpressionFactory());

            int result = parser.Evaluate(expression);

            Console.WriteLine($"{expression} = {result}");
        }