!7 srecord DollarVarPattern(S pat) {} srecord Definition(O lhs, O rhs) {} srecord PatternMatches(O pat, O s) {} sS defs = [[ A cup of water = A cup with water inside A cup of Peter = A cup that belongs to Peter A cup of glass = A cup that consists of glass A cup of style = A cup that has a lot of style ]]; p-exp { new LinkedHashSet objects; for (S s : tlft(defs)) { L l = splitAtJavaToken(s, "="); objects.add(Definition(first(l), second(l))); } L defs = instancesOf(Definition, objects); for (Definition a : defs) for (Definition b : defs) if (a.lhs instanceof S && b.lhs instanceof S) { S pat = combineToDollarVarPattern((S) a.lhs, (S) b.lhs); if (containsDollarVars(pat)) objects.add(DollarVarPattern(pat)); } pnlStruct(objects); }