private Context convert(Context context) { reset(); gatherVars(context.body()); gatherVars(context.requires()); K body = convert(context.body()); return Context( body, addSideCondition(context.requires()), context.att()); }
public Rule convert(Rule r) { Function1<Sentence, Sentence> convertLookups = new ConvertDataStructureToLookup(this.convertDataStructure)::convert; Function1<Sentence, Sentence> liftToKSequence = new LiftToKSequence()::lift; Function1<Sentence, Sentence> deconstructInts = new DeconstructIntegerAndFloatLiterals()::convert; Function1<Sentence, Sentence> expandMacros = this.expandMacros::expand; return (Rule) convertLookups .andThen(deconstructInts) .andThen(expandMacros) .andThen(liftToKSequence) .apply(r); }
@Override public K apply(KToken k) { if (lhs) { if (k.sort().equals(Sorts.Int()) || k.sort().equals(Sorts.Float())) { KVariable var = newDotVariable(k.sort()); state.add(KApply(KLabel("_==" + k.sort().name() + "_"), var, k)); return var; } } return super.apply(k); }
this.expandMacros = new ExpandMacros(def.executionModule(), files, kompileOptions, false); ModuleTransformer expandMacros = ModuleTransformer.fromSentenceTransformer(this.expandMacros::expand, "expand macro rules"); ModuleTransformer deconstructInts = ModuleTransformer.fromSentenceTransformer(new DeconstructIntegerAndFloatLiterals()::convert, "remove matches on integer literals in left hand side"); this.threadCellExists = containsThreadCell(def); this.exitCodePattern = def.exitCodePattern;
private Rule convert(Rule rule) { reset(); gatherVars(rule.body()); gatherVars(rule.requires()); gatherVars(rule.ensures()); K body = convert(rule.body()); K requires = convertLookups(rule.requires()); return Rule( body, addSideCondition(requires), rule.ensures(), rule.att()); }