Skip to content

Commit

Permalink
changes to make build pass
Browse files Browse the repository at this point in the history
  • Loading branch information
msaxena2 committed May 20, 2017
1 parent 9e315fd commit 0012059
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/scala/org/kframework/backend/skala/backendImplicits.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.kframework.backend.skala
import org.kframework.kore.extended.implicits._
import org.kframework.kore
import org.kframework.kore.implementation.{DefaultBuilders => db}

/**
* Implicits that add to Extended Kore
*/
object backendImplicits {
implicit class ModuleWithSubsorting(m: kore.Module)(implicit definiton: kore.Definition) {
private lazy val subsortRelations: Set[(kore.Sort, kore.Sort)] = m.allSentences.collect({
case kore.SymbolDeclaration(startSort, _, Seq(endSort), att) if att.findSymbol(db.Symbol("klabel")).isEmpty => (endSort, startSort)
}).toSet

lazy val subsorts: POSet[kore.Sort] = POSet(subsortRelations)

lazy val sortsFor: Map[kore.Symbol, Set[kore.Sort]] = m.allSentences.collect({
case kore.SymbolDeclaration(s, sym, _, _) => (sym, s)
}).groupBy(_._1).mapValues(_.map(_._2).toSet)
}
}

0 comments on commit 0012059

Please sign in to comment.