예제 #1
0
        public ProvStartTU_RX(MGRX.ProvStartNode start_node)
        {
            // copy pasta'd from base()

            preCH primStepsLHS = null;

            if (start_node.rootIsSG)
            {
                root_SG_edge = new Root_SG_EdgeTU(start_node.startSG);
                rootIsSG     = true;
                primStepsLHS = root_SG_edge.preCH_out;
            }
            else
            {
                var dummy_root_CH = new TypedSingleCH <int>();
                dummy_Suigen = new OP_SuiGen <int>(dummy_root_CH, (_) => new [] { 1 });
                root_FunCall = new FunCallTU_RX(new adapter_preCH(dummy_root_CH), (MGRX.FunCallNodeRX)start_node.startFuncall);
                rootIsSG     = false;
                primStepsLHS = root_FunCall.preCH_out;
            }
            var   L             = new List <PrimitveStepTU>();
            preCH current_preCH = primStepsLHS;

            foreach (var prim_step in start_node.primSteps)
            {
                var TU = new PrimitveStepTU_RX(current_preCH, prim_step);
                L.Add(TU);
                current_preCH = TU.preCH_out;
            }
            subsequent_Steps = L.ToArray();
        }
예제 #2
0
        public static void Test4_still_fanning_and_analyz0r(bool analyz0r = false)
        {
            var lhsCH = new TypedSingleCH <TestcasesLHSType>();

            var FanGE = new GrammarEntry {
                StartProd      = MG.Fan,
                TR_constructor = (nnode) => new FanTU(new adapter_preCH(lhsCH), (MG.FanNode)nnode)
            };
            var trslLHS = new TranslateLHS {
                preCH_LHS = new adapter_preCH(lhsCH),
                scope     = new CH_closedScope()
            };

            var compilat = TranslateEntry.TranslateFully_incomplete_tolerant(" { ..intMem1 -> x <- @4 ->x2  , ..intMem2  <- $x2 }  ", FanGE, trslLHS);

            if (analyz0r)
            {
                Analyz0r.A.JsonifyCompilat(compilat, "_Test4_still_fanning");
            }

            var MM         = new MemMapper();
            var LHS_column = MM.get(lhsCH);

            LHS_column.AddVal(new TestcasesLHSType());
            LHS_column.AddVal(new TestcasesLHSType());
            LHS_column.AddVal(new TestcasesLHSType());
            Evaluate.Eval(compilat, MM);

            if (analyz0r)
            {
                Analyz0r.A.JsonifyEval(compilat, MM, "_Test4_still_fanning");
            }
        }
예제 #3
0
        public static void Test3_Fans_and_Literals()
        {
            var lhsCH = new TypedSingleCH <TestcasesLHSType>();

            var FanGE = new GrammarEntry {
                StartProd      = MG.Fan,
                TR_constructor = (nnode) => new FanTU(new adapter_preCH(lhsCH), (MG.FanNode)nnode)
            };
            var lhsColumn = (ColumnSingle <TestcasesLHSType>)lhsCH.SpawnColumn();

            lhsColumn.AddVal(new TestcasesLHSType(), null);

            CH_closedScope outScope;

            var TR_LHS = new TranslateLHS {
                preCH_LHS = new adapter_preCH(lhsCH),                 // different instance then GrammarEntry - intentional
                scope     = new CH_closedScope()
            };
            var MM = new MemMapper();

            MM.D[lhsCH] = lhsColumn;
            Column res = Evaluate.Eval_incomplete_tolerant(" { ..intMem1 -> x <- @4 ->x2  , ..intMem2  <- $x2 }  ", FanGE, TR_LHS, MM, out outScope);

            Console.WriteLine(" -------------- ");
            foreach (var v in (res as Column <TestcasesLHSType>).valuesT)
            {
                Console.WriteLine(v);
            }

            Console.WriteLine(" ---.---.--.--.---- ");
            foreach (var KV in MM.D)
            {
                Console.WriteLine(KV.Key + " :: " + KV.Value);
            }
        }
예제 #4
0
 public RootVBoxTR(bool descend_all)
 {
     this.descend_all = descend_all;
     rootCH           = new TypedSingleCH <ROOT>();
     GO_cOut          = new TypedSingleCH <GameObject>();
 }
예제 #5
0
        public static void Test1()
        {
            //LexxAndRun( ".*foo -> x <- y  -> z " );
            Console.WriteLine(LexxAndParse(".*foo", MG.MemA));
            Console.WriteLine(LexxAndParse(".*foo -> x ", MG.MemAVT));
            Console.WriteLine(LexxAndParse(".*foo -> x ", MGRX.MemAVT_RX));
            Console.WriteLine(LexxAndParse("..str", MGRX.MemAVT_RX));
            Console.WriteLine(LexxAndParse("..str -> foo", MGRX.MemAVT_RX));

            Console.WriteLine(LexxAndParse("..str -> foo", TestMG1.TestStartRX));
            Console.WriteLine("----------- whoooo ------- ");

            Console.WriteLine(LexxAndParse("  <- $XX ", MG.SingleAssign));
            Console.WriteLine(LexxAndParse("  <- $XX -> a -> b ", MG.AssignVT));

            Console.WriteLine(LexxAndParse(" .*foo -> decl1 <- $ARG -> decl2 ", TestMG1.TestStart));


            // -----------------------------------------------------------------

            var MM            = new MemMapper();
            var dollar_arg_CH = new TypedSingleCH <int>();

            // Method I: hack column entries into MM directly
            ColumnSingle <int> dollar_arg_Column = (ColumnSingle <int>)dollar_arg_CH.SpawnColumn();       // todo: maybe provide SpawnColumnT that "kinda-overloads" on the return type

            MM.D[dollar_arg_CH] = dollar_arg_Column;


            dollar_arg_Column.AddVal(3, null);
            dollar_arg_Column.AddVal(4, null);

            // Method II: abuse MemMapper for column creation
            ColumnSingle <TestcasesLHSType> LHS_column;

            LHS_column = MM.get(DummyInstances.TestcasesLHSsingletonTypedCH);                             // TypedSingle<DummyType>

            LHS_column.AddVal(new TestcasesLHSType(), null);
            LHS_column.AddVal(new TestcasesLHSType(), null);
            LHS_column.AddVal(new TestcasesLHSType(), null);

            CH_closedScope scope = new CH_closedScope();

            scope = scope.decl("ARG", dollar_arg_CH);

            CH_closedScope out_scope;



            var TR_LHS = new TranslateLHS {
                preCH_LHS = new adapter_preCH(DummyInstances.TestcasesLHSsingletonTypedCH),
                scope     = scope
            };

            Console.WriteLine("in -> " + LHS_column);
            Column res = Evaluate.Eval_incomplete_tolerant(" ..intMem1 -> decl1 <- $ARG -> decl2 ", DummyInstances.GE_TestStart, TR_LHS, MM, out out_scope);

            foreach (var s in ColumnChainPrttS(
                         res,
                         CH => MM.D[CH]
                         ).Reverse())
            {
                Console.WriteLine(s);
            }
        }