Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Parser parser = new Parser();

            string testExpr = String.Empty;

            while (true)
            {
                Console.Write("> ");
                testExpr = Console.ReadLine();
                if (exitCommand(testExpr))
                {
                    break;
                }
                else if (clearCommand(testExpr))
                {
                    Console.Clear();
                    continue;
                }
                else
                {
                    parser.tokenizeExpression(testExpr);

                    ArrayList postfixTest = parser.InputToPostfix();

                    Console.WriteLine("= " + parser.evaluatePostfix(postfixTest));
                }
            }
        }