/// <summary>
        /// This is the modified Shunting Yard algorithm. First it reads the symbols/tokens
        /// and pushes them to the correct stack. It will then call calulate on certain operators,
        /// this follows order of presidence/BIDMAS
        /// </summary>
        /// <returns></returns>
        public double ShuntYard()
        {
            int count = 0;

            while (count < LT.symbols.Length)
            {
                switch (LT.GetSymbol(count).Type)
                {
                case Tokens.Integer:
                    Numbers.Push(LT.GetSymbol(count++).Value);
                    break;

                case Tokens.Double:
                    Numbers.Push(LT.GetSymbol(count++).Value);
                    break;

                case Tokens.Variable:
                    Numbers.Push(LT.GetSymbol(count++).Value);
                    break;

                case Tokens.Equal:
                    Operators.Push(LT.GetSymbol(count++).Type);
                    break;

                case Tokens.Plus:
                    while (Operators.Count > 0 && (Tokens)Operators.Peek() != Tokens.Left_Parenthesis && (Tokens)Operators.Peek() != Tokens.Equal)
                    {
                        Calculate();
                    }
                    Operators.Push(LT.GetSymbol(count++).Type);
                    break;

                case LookupTable.Tokens.Minus:
                    while (Operators.Count > 0 && (Tokens)Operators.Peek() != Tokens.Left_Parenthesis && (Tokens)Operators.Peek() != Tokens.Equal)
                    {
                        Calculate();
                    }
                    Operators.Push(LT.GetSymbol(count++).Type);
                    break;

                case LookupTable.Tokens.Multiply:
                    while (Operators.Count > 0 && (Tokens)Operators.Peek() != Tokens.Left_Parenthesis &&
                           (Tokens)Operators.Peek() != Tokens.Plus && (Tokens)Operators.Peek() != Tokens.Minus &&
                           (Tokens)Operators.Peek() != Tokens.Equal)
                    {
                        Calculate();
                    }
                    Operators.Push(LT.GetSymbol(count++).Type);
                    break;

                case LookupTable.Tokens.Divide:
                    while (Operators.Count > 0 && (Tokens)Operators.Peek() != Tokens.Left_Parenthesis &&
                           (Tokens)Operators.Peek() != Tokens.Plus && (Tokens)Operators.Peek() != Tokens.Minus &&
                           (Tokens)Operators.Peek() != Tokens.Equal)
                    {
                        Calculate();
                    }
                    Operators.Push(LT.GetSymbol(count++).Type);
                    break;

                case LookupTable.Tokens.Exponent:
                    while (Operators.Count > 0 && (Tokens)Operators.Peek() != Tokens.Left_Parenthesis &&
                           (Tokens)Operators.Peek() != Tokens.Plus && (Tokens)Operators.Peek() != Tokens.Minus &&
                           (Tokens)Operators.Peek() != Tokens.Equal && (Tokens)Operators.Peek() != Tokens.Multiply &&
                           (Tokens)Operators.Peek() != Tokens.Divide)
                    {
                        Calculate();
                    }
                    Operators.Push(LT.GetSymbol(count++).Type);
                    break;

                case LookupTable.Tokens.Left_Parenthesis:
                    Operators.Push(LT.GetSymbol(count++).Type);
                    break;

                case LookupTable.Tokens.Right_Parenthesis:
                    while (Operators.Count > 0 && (LookupTable.Tokens)Operators.Peek() != LookupTable.Tokens.Left_Parenthesis)
                    {
                        Calculate();
                    }
                    if ((LookupTable.Tokens)Operators.Peek() == LookupTable.Tokens.Left_Parenthesis)
                    {
                        Operators.Pop();
                    }
                    count++;
                    break;

                default:
                    count++;
                    break;
                }
            }
            //This is a fail safe to make sure that all operators are used.
            while (Operators.Count > 0)
            {
                Calculate();
            }

            //This if exists as an assignment of a variable will not return back
            //to the numbers stack.
            if (Numbers.Count == 1)
            {
                return(Convert.ToDouble(Numbers.Pop()));
            }
            else
            {
                return(0);
            }
        }