Advanced Functional Prog.

back - up - cont


Parsing expressions

A last useful operator can be defined for repetitions:

let rec rep p s = 
  match p s with
  | [(r,s')] -> rep p s'
  | _        -> [("end",s)];;

rep (sym 'o') "oooh!";;

5 - 18