app5.scala
changeset 7 73cf4406b773
equal deleted inserted replaced
6:0da19c346e24 7:73cf4406b773
       
     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 }