let concat_patterns p1 p2 =
  match (p1,p2) with
  | (Epsilon,_) -> p2
  | (_,Epsilon-> p1
  | (_,_)       -> Concat(p1,p2)