app5.scala
author Christian Urban <urbanc@in.tum.de>
Mon, 29 Oct 2012 12:31:31 +0000
changeset 49 d2c6852ca8da
parent 7 73cf4406b773
permissions -rw-r--r--
added programs and slides

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
}