public Module resolve(Module input) { Set<Sentence> rulesToAdd = stream(input.sentences()) .filter(s -> s instanceof Context) .map(s -> (Context) s) .flatMap(c -> this.resolve(c, input)).collect(Collectors.toCollection(HashSet::new)); if (!rulesToAdd.isEmpty()) { rulesToAdd.add(SyntaxSort(Sorts.K())); } return Module(input.name(), input.imports(), (scala.collection.Set<Sentence>) stream(input.localSentences()).filter(s -> !(s instanceof Context)).collect(Collections.toSet()).$bar(immutable(rulesToAdd)), input.att()); }
public Module gen(Module mod) { Set<Sentence> res = new HashSet<>(); for (Sort sort : iterable(mod.definedSorts())) { Production prod = Production(KLabel("is" + sort.toString()), Sorts.Bool(), Seq(Terminal("is" + sort.toString()), Terminal("("), NonTerminal(Sorts.K()), Terminal(")")), Att().add(Attribute.FUNCTION_KEY).add(Attribute.PREDICATE_KEY, Sort.class, sort)); if (!mod.productions().contains(prod)) res.add(prod); } if (!res.isEmpty()) { res.add(SyntaxSort(Sorts.K())); } return Module(mod.name(), mod.imports(), (scala.collection.Set<Sentence>) mod.localSentences().$bar(immutable(res)), mod.att()); } }
res.add(SyntaxSort(sort, convertAttributes(s))); return res;
res.add(prod3); res.add(prod4); res.add(SyntaxSort(Sort(ul.sort.name() + "#Terminator", ul.sort.params()))); res.add(SyntaxSort(Sort("Ne#" + ul.sort.name(), ul.sort.params()))); if (!ul.nonEmpty) { res.add(prod5);
+ ". Should be one of: Set, Bag, List, Map"); SyntaxSort sortDecl = SyntaxSort(bagSort, Att().add("hook", type.toUpperCase() + '.' + type)); Sentence bagSubsort = Production(bagSort, Seq(NonTerminal(sort))); Sentence bagElement;
Seq(Terminal("<threads>"), NonTerminal(Sort("ThreadCellBag")), Terminal("</threads>")), Att().add("cell").add("cellName", "threads").add("topcell").add("format", "%1%i%n%2%d%n%3")), SyntaxSort(Sort("ThreadCellBag"), Att().add("hook", "BAG.Bag")), Production(KLabel("_ThreadCellBag_"), Sort("ThreadCellBag"), Seq(NonTerminal(Sort("ThreadCellBag")), NonTerminal(Sort("ThreadCellBag"))),