예제 #1
0
 public static Type_OBJECT Singleton()
 {
     if (singleton == null)
     {
         singleton = new Type_OBJECT();
     }
     return(singleton);
 }
        public Type_INT() :
            base("int", Type_OBJECT.Singleton(), new Attribute[] { }, null)
        {
            if (!Method_AritmeticOP.Operators.ContainsKey("+"))
            {
                Method_AritmeticOP.Operators.Add("+", (x, y) => x + y);
                Method_AritmeticOP.Operators.Add("-", (x, y) => x - y);
                Method_AritmeticOP.Operators.Add("*", (x, y) => x * y);
                Method_AritmeticOP.Operators.Add("/", (x, y) => x / y);
                Method_AritmeticOP.Operators.Add("<", (x, y) => (x < y) ? 1 : 0);
                Method_AritmeticOP.Operators.Add("<=", (x, y) => (x <= y) ? 1 : 0);
                Method_AritmeticOP.Operators.Add("=", (x, y) => (x == y) ? 1 : 0);
                Method_AritmeticOP.Operators.Add("~", (x, y) => ~y);
                Method_AritmeticOP.Operators.Add("not", (x, y) => (y != 0) ? 0 : 1);
            }
            List <IMethod> m = new List <IMethod>();

            foreach (var item in Method_AritmeticOP.Operators.Keys)
            {
                m.Add(new Method_AritmeticOP(item, this));
            }

            Methods = m.ToArray();
        }
예제 #3
0
 public Method_TypeName() : base("type_name", Type_STRING.Singleton(), new Attribute[] { new Attribute("self", Type_OBJECT.Singleton(), 0) })
 {
 }
예제 #4
0
 public Type_STRING() : base("string", Type_OBJECT.Singleton(), new Attribute[] { }, new IMethod[] { })
 {
 }