Attic/rev.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 19 Sep 2024 16:32:26 +0100 (4 months ago)
changeset 962 5176cbb819c2
parent 742 b5b5583a3a08
permissions -rw-r--r--
test
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))
}