app5.scala
author Christian Urban <urbanc@in.tum.de>
Tue, 09 Oct 2012 21:19:47 +0100
changeset 23 ea594f94f85d
parent 7 73cf4406b773
permissions -rw-r--r--
tuned

def nullable (r: Rexp) : Boolean = r match {
  case NULL => false
  case EMPTY => true
  case CHAR(_) => false
  case ALT(r1, r2) => nullable(r1) || nullable(r2)
  case SEQ(r1, r2) => nullable(r1) && nullable(r2)
  case STAR(_) => true
}