progs/app5.scala
changeset 93 4794759139ea
parent 92 e85600529ca5
child 261 24531cfaa36a
equal deleted inserted replaced
92:e85600529ca5 93:4794759139ea
       
     1 def nullable (r: Rexp) : Boolean = r match {
       
     2   case NULL => false
       
     3   case EMPTY => true
       
     4   case CHAR(_) => false
       
     5   case ALT(r1, r2) => nullable(r1) || nullable(r2)
       
     6   case SEQ(r1, r2) => nullable(r1) && nullable(r2)
       
     7   case STAR(_) => true
       
     8 }