Example #1
0
        static void TestList()
        {
            __opColon__opColon <int> test    = MakeList <int>(new int[] { 5, 3, 2 });
            __opColon__opColon <int> addTest = MakeList <int>(new int[] { 1, 6 });

            length <int> __tmp0 = new length <int>();

            __tmp0.__arg0 = test;
            __tmp0.Run();

            append <int> __tmp1 = new append <int>();

            __tmp1.__arg0 = test;
            __tmp1.__arg1 = addTest;
            __tmp1.Run();

            if (__tmp0.__res.HasValue)
            {
                Console.WriteLine(__tmp0.__res.Value);
            }
            else
            {
                Console.WriteLine("The rule has failed its evaluation");
            }

            if (__tmp1.__res.HasValue)
            {
                Console.WriteLine(__tmp1.__res.Value);
            }
            else
            {
                Console.WriteLine("The rule has failed its evaluation");
            }
        }
Example #2
0
        static __opColon__opColon <a> MakeList <a>(a[] arr)
        {
            __opColon__opColon <a> l     = new __opColon__opColon <a>();
            __opColon__opColon <a> __tmp = new __opColon__opColon <a>();

            l = __tmp;

            for (int i = 0; i < arr.Length - 1; i++)
            {
                __tmp.__arg0 = arr[i];
                __tmp.__arg1 = new __opColon__opColon <a>();
                __tmp        = (__opColon__opColon <a>)__tmp.__arg1;
            }
            __tmp.__arg0 = arr[arr.Length - 1];
            __tmp.__arg1 = new nil <a>();

            return(l);
        }
Example #3
0
        public void Run()
        {
            int __ruleIndex = 0;

            __res          = new __MetaCnvResult <GameState>();
            __res.HasValue = false;
            __res.Value    = default(GameState);


            switch (__ruleIndex)
            {
            case 0:
            {
                float dt = default(float);
                dt = __arg0;
                __opDollarVector2 p = new __opDollarVector2();
                p.__arg0 = 1.0f;
                p.__arg1 = 1.0f;
                __opDollarVector2 vx = new __opDollarVector2();
                vx.__arg0 = 1.0f;
                vx.__arg1 = 0.0f;
                __opDollarVector2 vx1 = new __opDollarVector2();
                vx1.__arg0 = -1.0f;
                vx1.__arg1 = 0.0f;
                __opDollarVector2 vy = new __opDollarVector2();
                vy.__arg0 = 0.0f;
                vy.__arg1 = 1.0f;
                when       s1     = new when();
                __opDollar __tmp0 = new __opDollar();
                __tmp0.__arg0 = "Position";
                vectorx __tmp1 = new vectorx();
                __tmp1.__arg0 = __tmp0;
                lt __tmp2 = new lt();
                __tmp2.__arg0 = __tmp1;
                __opDollarf __tmp3 = new __opDollarf();
                __tmp3.__arg0 = 30.0f;
                __tmp2.__arg1 = __tmp3;
                s1.__arg0     = __tmp2;
                yield s2 = new yield();
                __opColon__opColon <Expr> __tmp4 = new __opColon__opColon <Expr>();
                __tmp4.__arg0 = vx;
                __tmp4.__arg1 = new nil <Expr>();
                s2.__arg0     = __tmp4;
                when       s3     = new when();
                __opDollar __tmp5 = new __opDollar();
                __tmp5.__arg0 = "Position";
                vectorx __tmp6 = new vectorx();
                __tmp6.__arg0 = __tmp0;
                gt __tmp7 = new gt();
                __tmp7.__arg0 = __tmp1;
                __opDollarf __tmp8 = new __opDollarf();
                __tmp8.__arg0 = 0.0f;
                __tmp7.__arg1 = __tmp8;
                s3.__arg0     = __tmp7;
                yield s4 = new yield();
                __opColon__opColon <Expr> __tmp9 = new __opColon__opColon <Expr>();
                __tmp9.__arg0 = vx1;
                __tmp9.__arg1 = new nil <Expr>();
                s4.__arg0     = __tmp9;
                yield s5 = new yield();
                __opColon__opColon <Expr> __tmp10 = new __opColon__opColon <Expr>();
                __opPlus   __tmp11 = new __opPlus();
                __opDollar __tmp12 = new __opDollar();
                __opDollar __tmp13 = new __opDollar();
                __tmp12.__arg0 = "Position";
                __tmp13.__arg0 = "Velocity";
                __tmp11.__arg0 = __tmp12;
                __tmp11.__arg1 = __tmp13;
                __tmp10.__arg0 = __tmp11;
                __tmp10.__arg1 = new nil <Expr>();
                s5.__arg0      = __tmp10;
                ImmutableDictionary <string, Value> dict1 = ImmutableDictionary <string, Value> .Empty.Add("Position", p);

                ImmutableDictionary <string, Value> dict = dict1.Add("Velocity", vx);

                //r1
                __opColon__opColon <string> __r1tmp0 = new __opColon__opColon <string>();
                __r1tmp0.__arg0 = "Velocity";
                __r1tmp0.__arg1 = new nil <string>();
                __opSemicolon __r1tmp1 = new __opSemicolon();
                __r1tmp1.__arg0 = s1;
                __r1tmp1.__arg1 = s2;
                rule r1 = new rule();
                r1.__arg0 = __r1tmp0;
                r1.__arg1 = __r1tmp1;
                r1.__arg2 = new nop();
                r1.__arg3 = ImmutableDictionary <string, Value> .Empty;
                r1.__arg4 = dt;

                //r2
                __opColon__opColon <string> __r2tmp0 = new __opColon__opColon <string>();
                __r2tmp0.__arg0 = "Velocity";
                __r2tmp0.__arg1 = new nil <string>();
                __opSemicolon __r2tmp1 = new __opSemicolon();
                __r2tmp1.__arg0 = s3;
                __r2tmp1.__arg1 = s4;
                rule r2 = new rule();
                r2.__arg0 = __r2tmp0;
                r2.__arg1 = __r2tmp1;
                r2.__arg2 = new nop();
                r2.__arg3 = ImmutableDictionary <string, Value> .Empty;
                r2.__arg4 = dt;

                //r3
                __opColon__opColon <string> __r3tmp0 = new __opColon__opColon <string>();
                __r3tmp0.__arg0 = "Position";
                __r3tmp0.__arg1 = new nil <string>();
                rule r3 = new rule();
                r3.__arg0 = __r3tmp0;
                r3.__arg1 = s5;
                r3.__arg2 = new nop();
                r3.__arg3 = ImmutableDictionary <string, Value> .Empty;
                r3.__arg4 = dt;

                tick __tick = new tick();
                __opColon__opColon <Rule> __ticktmp0 = new __opColon__opColon <Rule>();
                __opColon__opColon <Rule> __ticktmp1 = new __opColon__opColon <Rule>();
                __opColon__opColon <Rule> __ticktmp2 = new __opColon__opColon <Rule>();
                __ticktmp2.__arg0 = r3;
                __ticktmp2.__arg1 = new nil <Rule>();
                __ticktmp1.__arg0 = r2;
                __ticktmp1.__arg1 = __ticktmp2;
                __ticktmp0.__arg0 = r3;               //r1;
                __ticktmp0.__arg1 = new nil <Rule>(); //__ticktmp1;

                __opColon__opColon <Rule> __ticktmp3 = new __opColon__opColon <Rule>();
                __opColon__opColon <Rule> __ticktmp4 = new __opColon__opColon <Rule>();
                __opColon__opColon <Rule> __ticktmp5 = new __opColon__opColon <Rule>();
                __ticktmp5.__arg0 = r3;
                __ticktmp5.__arg1 = new nil <Rule>();
                __ticktmp4.__arg0 = r2;
                __ticktmp4.__arg1 = __ticktmp5;
                __ticktmp3.__arg0 = r3;               //r1;
                __ticktmp3.__arg1 = new nil <Rule>(); //__ticktmp4;

                __tick.__arg0 = __ticktmp0;
                __tick.__arg1 = __ticktmp3;
                __tick.__arg2 = dict;
                __tick.__arg3 = ImmutableDictionary <string, Value> .Empty;
                __tick.__arg4 = dt;
                __tick.Run();

                if (!(__tick.__res.HasValue))
                {
                    goto default;
                }
                __MetaCnvResult <GameState> __restmp0 = __tick.__res;
                GameState __restmp1 = __restmp0.Value;
                __res.HasValue = true;
                __res.Value    = __restmp1;
                break;
            }

            default: break;
            }
        }