static public Constant Convert(Constant constant, Constant.Type newType)
        {
            if (newType == constant.ConstantType)
            {
                return(constant);
            }
            switch (newType)
            {
            case Constant.Type.Complex:
                if (constant.ConstantType == Constant.Type.Float)
                {
                    return(new ComplexValue((constant as FloatValue).Value, 0.0));
                }
                else if (constant.ConstantType == Constant.Type.Int)
                {
                    return(new ComplexValue((constant as IntValue).Value, 0.0));
                }
                break;

            case Constant.Type.Float:
                if (constant.ConstantType == Constant.Type.Int)
                {
                    return(new FloatValue((constant as IntValue).Value));
                }
                if (constant.ConstantType == Constant.Type.Bool)
                {
                    return(new FloatValue((constant as BoolValue).Value ? 1.0 : 0.0));
                }
                break;

            case Constant.Type.String:
                return(constant.CastToString());

            case Constant.Type.Int:
                if (constant.ConstantType == Constant.Type.Bool)
                {
                    return(new IntValue((constant as BoolValue).Value ? 1 : 0));
                }
                break;

            case Constant.Type.Bool:
                if (constant.ConstantType == Constant.Type.Int)
                {
                    return(new BoolValue((constant as IntValue).Value == 0 ? true : false));
                }
                break;
            }
            throw new TypeConversionError(constant.ConstantType.ToString(), newType.ToString());
        }