progs/app51.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Sat, 16 May 2020 17:18:43 +0100
changeset 724 61a936be50c4
parent 399 5c1fbb39c93e
permissions -rw-r--r--
test

def OPT(r: Rexp) = ALT(r, ONE)

def NTIMES(r: Rexp, n: Int) : Rexp = n match {
  case 0 => ONE
  case 1 => r
  case n => SEQ(r, NTIMES(r, n - 1))
}