use of facade.PData in project L42 by ElvisResearchGroup.
the class Executor method meta1Prop.
protected ClassB meta1Prop(Program p, ClassB cb, NestedClass m) {
log("---meta1Prop--");
//get cb-->ct
//get p'
Program p1 = p.evilPush(cb);
//extract e
ExpCore e = m.getInner();
//extract cb
Ctx<ClassB> ctxC = ExtractCtxCompiled.of(e);
//run cb1-->cb2
ClassB cb2 = (ClassB) step(new PData(p1), ctxC.hole);
ExpCore e2 = ReplaceCtx.of(ctxC.ctx, cb2);
//compose cb with new member
return cb.withMember(m.withInner(e2));
}
use of facade.PData in project L42 by ElvisResearchGroup.
the class Executor method stepStar.
public static ExpCore stepStar(Executor executer, ExpCore e) {
final Program emptyP = Program.emptyLibraryProgram();
int iteration = 0;
dbgRecordNext(e);
executer.log("--------------------" + (iteration += 1));
//TestHelper.dbgCompact(e);
try {
while (true) {
assert coreVisitors.CheckNoVarDeclaredTwice.of((ClassB) e);
e = NormalizeBlocks.of(e);
e = executer.step(new PData(emptyP), e);
dbgRecordNext(e);
assert coreVisitors.CheckNoVarDeclaredTwice.of((ClassB) e);
executer.log("--------------------" + (iteration += 1));
//TestHelper.dbgCompact(e);
}
}//catch(ErrorMessage.NormalForm mess){ return mess.getE();}
catch (ErrorMessage.CtxExtractImpossible mess) {
assert e instanceof ClassB;
if (!L42.trustPluginsAndFinalProgram) {
ClassB ct = (ClassB) e;
Program p1 = emptyP.evilPush(ct);
//I think this is all old code?
assert false;
//Configuration.typeSystem.checkCt( emptyP, ct);
/*if(!p1.checkComplete()){//also check is star
throw new ErrorMessage.MalformedFinalResult(ct,
"Some class can not be completely typed as is still incomplete or refers to incomplete classes"
+ErrorFormatter.reportPlaceOfMetaError(p1,ct)
);
}*/
}
return e;
}
}
use of facade.PData in project L42 by ElvisResearchGroup.
the class TranslationTest method tester.
public void tester(String cbStr, String eStr, String nameRes) {
TestHelper.configureForTest();
Program p = runTypeSystem(cbStr);
ExpCore _e = Desugar.of(Parser.parse(null, eStr)).accept(new InjectionOnCore());
ExpCore e = newTypeSystem.TypeSystem.instance().topTypeExpVoid(p, _e);
Translator code = Resources.withPDo(new PData(p), () -> Translator.translateProgram(p, e));
System.out.println(code);
Object o = Resources.withPDo(new PData(p), () -> code.runMap());
Assert.assertEquals(o.getClass().getName(), nameRes);
}
use of facade.PData in project L42 by ElvisResearchGroup.
the class Executor method metaMethod.
protected ClassB metaMethod(Program p, ClassB cb, Member m) {
log("---meta2--");
//get cb-->ct
//get p'
Program p1 = p.evilPush(cb);
//extract e
ExpCore e = m.getInner();
//extract cb
Ctx<ClassB> ctxC = ExtractCtxCompiled.of(e);
//run cb1-->cb2
ClassB cb2 = (ClassB) step(new PData(p1), ctxC.hole);
ExpCore e2 = ReplaceCtx.of(ctxC.ctx, cb2);
//compose cb with new member
return cb.withMember(m.withInner(e2));
}
use of facade.PData in project L42 by ElvisResearchGroup.
the class SmallStep method meta1.
protected ClassB meta1(Program p, ClassB cb, NestedClass m) {
log("---meta1--");
ExpCore e1 = m.getInner();
//get p'
try {
Program p1 = p.evilPush(cb);
ErrorFormatter.printType(p1);
//check p'
//Configuration.typeSystem.checkAll(p1);
//e1=Norm.of(p1,e1);
//check e1
//Configuration.typeSystem.checkMetaExpr(p1.getExecutableStar(),e1);
//run m.e1-->e2
ExpCore e2 = executeAtomicStep(new PData(p1), e1, m.getName());
//if(!(e2 instanceof ClassB)){Configuration.typeSystem.checkMetaExpr(p1.getExecutableStar(),e2);}//TODO: as assert
ClassB cbRes = cb.withMember(m.withInner(e2));
//replace cb[m.e2]
return cbRes;
} finally {
}
}
Aggregations