If I may ask another question please, what type of token would you give that rule, i.e. for example a new Class Neccessity(subject or variable, action, expr) ?
sealed trait NecTarget
object NecTarget {
case class Sub(value: Int) extends NecTarget
case class Var(name: String) extends NecTarget
}
case class Nec(target: NecTarget, action: String, name: String)
…but it really depends on the concrete semantics of the subject/variable/nec concepts.