public Sentence concretize(Sentence s) { s = addRootCell.addImplicitCells(s); s = addParentCells.concretize(s); s = closeCells.close(s); s = sortCells.preprocess(s); s = sortCells.sortCells(s); s = sortCells.postprocess(s); return s; } }
public ConcretizeCells(ConfigurationInfo configurationInfo, LabelInfo labelInfo, SortInfo sortInfo, Module module) { this.configurationInfo = configurationInfo; this.labelInfo = labelInfo; this.sortInfo = sortInfo; this.module = module; addRootCell = new AddTopCellToRules(configurationInfo, labelInfo); addParentCells = new AddParentCells(configurationInfo, labelInfo); closeCells = new CloseCells(configurationInfo, sortInfo, labelInfo); sortCells = new SortCells(configurationInfo, labelInfo, module); }
public SplitThreadsCell(Module m) { collectionFor = ConvertDataStructureToLookup.collectionFor(m); this.m = m; this.info = new LabelInfoFromModule(m); this.configInfo = new ConfigurationInfoFromModule(m); }
public static Module transformModule(Module mod) { ConfigurationInfoFromModule configInfo = new ConfigurationInfoFromModule(mod); LabelInfo labelInfo = new LabelInfoFromModule(mod); SortInfo sortInfo = SortInfo.fromModule(mod); return ModuleTransformer.fromSentenceTransformer( new ConcretizeCells(configInfo, labelInfo, sortInfo, mod)::concretize, "concretizing configuration").apply(mod); }
public static Module transformModule(Module mod) { ConfigurationInfoFromModule configInfo = new ConfigurationInfoFromModule(mod); LabelInfo labelInfo = new LabelInfoFromModule(mod); return ModuleTransformer.fromSentenceTransformer( new AddImplicitComputationCell(configInfo, labelInfo), "concretizing configuration").apply(mod); }
@Override public void apply(K k) { if (isLHS() && !isRHS() && !(k instanceof KVariable)) { cache.put(k, newDotVariable(sorts.sort(k, Sorts.K()))); } super.apply(k); }
public K addImplicitCells(K term) { if (labelInfo.isFunction(term)) return term; return addRootCell(term); }
public boolean isParentCell(KLabel klabel) { return isCell(klabel) && cfg.isParentCell(labels.getCodomain(klabel)); }
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); }
public boolean isCellCollection(KLabel klabel) { Sort s = labels.getCodomain(klabel); return cfg.isCellCollection(s); }
public KLabel getCellFragmentLabel(KLabel cellLabel) { Sort s = labels.getCodomain(cellLabel); return cfg.getCellFragmentLabel(s); }
public ConfigurationInfo.Multiplicity getMultiplicity(KLabel label) { return cfg.getMultiplicity(labels.getCodomain(label)); } public ConfigurationInfo.Multiplicity getMultiplicity(Sort sort) {
public boolean isLeafCell(KLabel klabel) { return cfg.isLeafCell(labels.getCodomain(klabel)); } public boolean isParentCell(KLabel klabel) {
public Sort leafCellType(KLabel label) { return cfg.leafCellType(labels.getCodomain(label)); } public List<Sort> getChildren(KLabel label) {
public Sort getCellSort(KLabel cellLabel) { Sort s = labels.getCodomain(cellLabel); return cfg.isCell(s) ? s : null; }
public List<Sort> getChildren(KLabel label) { return cfg.getChildren(labels.getCodomain(label)); }
public int getLevel(KLabel label) { return cfg.getLevel(labels.getCodomain(label)); }
public CloseCells(ConfigurationInfo cfg, SortInfo sortInfo, LabelInfo labelInfo) { this.cfg = new ConcretizationInfo(cfg, labelInfo); this.sortInfo = sortInfo; this.labelInfo = labelInfo; }
private Sentence concretizeSentence(Sentence s, Definition input) { ConfigurationInfoFromModule configInfo = new ConfigurationInfoFromModule(input.mainModule()); LabelInfo labelInfo = new LabelInfoFromModule(input.mainModule()); SortInfo sortInfo = SortInfo.fromModule(input.mainModule()); return new ConcretizeCells(configInfo, labelInfo, sortInfo, input.mainModule()).concretize(s); } }
public static Definition transformDefinition(Definition input) { ConfigurationInfoFromModule configInfo = new ConfigurationInfoFromModule(input.mainModule()); LabelInfo labelInfo = new LabelInfoFromModule(input.mainModule()); SortInfo sortInfo = SortInfo.fromModule(input.mainModule()); return DefinitionTransformer.fromSentenceTransformer( new ConcretizeCells(configInfo, labelInfo, sortInfo, input.mainModule())::concretize, "concretizing configuration" ).apply(input); }