app5.scala
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 03 Dec 2012 15:35:27 +0000
changeset 85 1a4065f965fb
parent 7 73cf4406b773
permissions -rw-r--r--
added packages

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
}