progs/rev.scala
author Christian Urban <urbanc@in.tum.de>
Thu, 23 Mar 2017 14:49:26 +0000
changeset 481 acd8780bfc8b
parent 408 5322e1c46890
permissions -rw-r--r--
merged

def rev(r: Rexp) : Rexp = r match {
  case ZERO => ZERO
  case ONE => ONE
  case CHAR(c) => CHAR(c)
  case ALT(r1, r2) => ALT(rev(r1), rev(r2))
  case SEQ(r1, r2) => SEQ(rev(r2), rev(r1))
  case STAR(r) => STAR(rev(r))
}