public static CH_closedScope DummyScope() { CH_closedScope sc = new CH_closedScope(); sc = sc. decl("VDummyType", TestcasesLHSsingletonTypedCH). decl("Vint", DummyIntHeaderSing); return(sc); }
public static Column Eval_incomplete_tolerant(string strExpr, GrammarEntry GE, TranslateLHS trans_LHS, MemMapper MM, out CH_closedScope scope_out) { var compilat = TranslateEntry.TranslateFully_incomplete_tolerant(strExpr, GE, trans_LHS); scope_out = compilat.deltaScope.close(); #if todo_fixme // external refs in the scopes still need implementation ( done . todo plug this shit in ) foreach (var sc_ref in compilat.ownDecls) { scope_out = (ClosedScope)scope_out.decl(sc_ref); } #endif compilat.run(MM); // atm the MM keeps references on tmp columns around forever - some pruning mechanism is needed VBoxTU last_VBT = compilat.VBoxTrs.Last(); return(MM.getGen(last_VBT.CH_out)); }
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); } }