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); } }
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); } }