KVariable newDotVariable(Sort sort) { KVariable newLabel; do { newLabel = KVariable("_" + (counter++), Att().add("sort", sort.name())); } while (vars.contains(newLabel)); vars.add(newLabel); return newLabel; }
public Module gen(Module mod) { Set<Sentence> res = new HashSet<>(); for (Sort sort : iterable(mod.definedSorts())) { Production prod = Production( "is" + sort.name(), Sorts.Bool(), Seq( Terminal("is" + sort.name()), Terminal("("), NonTerminal(Sorts.K()), Terminal(")")), Att().add(Attribute.FUNCTION_KEY).add(Attribute.PREDICATE_KEY, sort.name())); if (!mod.productions().contains(prod)) res.add(prod); } return Module( mod.name(), mod.imports(), (scala.collection.immutable.Set<Sentence>) mod.localSentences().$bar(immutable(res)), mod.att()); }
@Override public scala.collection.Set<Sort> getCellBagSortsOfCell(Sort k) { return Set(Sort(k.name() + "Bag")); }