anchor.diff:          failwith (err ^ " expected")
   
   let rec listof prs sep err =
  -    prs ++ many (sep ++ fix err prs >> snd) >> (fun (h, t) -> h :: t)
  +    prs .>>. many (sep .>>. fix err prs >> snd) >> (fun (h, t) -> h :: t)
   
   let nothing input = [], input
   
   let elistof prs sep err =
  -    listof prs sep err || nothing;;
  +    listof prs sep err <|> nothing;;
   
   let leftbin prs sep cons err =
  -    prs ++ many (sep ++ fix err prs) >>
  +    prs .>>. many (sep .>>. fix err prs) >>
       (fun (x,opxs) ->
           let ops, xs = unzip opxs
           itlist2 (fun op y x -> cons op x y) (rev ops) (rev xs) x);;
   
   let rightbin prs sep cons err =
  -    prs ++ many (sep ++ fix err prs) >>
  +    prs .>>. many (sep .>>. fix err prs) >>
       (fun (x, opxs) ->
           if opxs = [] then x
           else
  
positive.code: 
  let rec atleast n prs i =
      (if n <= 0 then many prs
       else prs ++ atleast (n - 1) prs >> (fun (h,t) -> h :: t)) i
  
  let finished input =
      if input = [] then 0, input
  
negative.code:     function
          ((Ident s):: rest) ->
          if is_prefix s then s,rest else raise Noparse
        | _ -> raise Noparse
    let rec preterm i =
      mk_precedence (infixes()) typed_appl_preterm i
    and nocommapreterm i =
      let infs = filter (fun (s,_) -> s <> ",") (infixes())
      mk_precedence infs typed_appl_preterm i
    and typed_appl_preterm i =
      (appl_preterm .>>. possibly (a (Resword ":") .>>. pretype >> snd) >> lmk_typed) i
    and appl_preterm i =
      (pre_fix .>>. appl_preterm
       >> (fun (x,y) -> Combp(Varp(x,dpty),y))
        <|> binder_preterm .>>. many binder_preterm >>
          (fun (h,t) -> itlist (fun x y -> Combp(y,x)) (rev t) h)) i
    and binder_preterm i =
      (a (Resword "let") .>>.
       leftbin (preterm >> singleton1) (a (Resword "and")) (K (@)) "binding" .>>.
       a (Resword "in") .>>.
       preterm
      >> lmk_let
    <|> binder .>>. typed_apreterm .>>. many typed_apreterm .>>. a (Resword ".") .>>. preterm >> lmk_binder
    <|> atomic_preterm) i
    and typed_apreterm i =
      (atomic_preterm .>>. possibly (a (Resword ":") .>>. pretype >> snd) >> lmk_typed) i
    and atomic_preterm i =
      (try_user_parser
    <|> (a (Resword "(") .>>. a (Resword ":")) .>>. pretype .>>. a (Resword ")") >> lmk_univ
    <|> string >> pmk_string
    <|> a (Resword "(") .>>. (any_identifier >> (fun s -> Varp(s,dpty))) .>>. a (Resword ")") >> (snd << fst)
    <|> a (Resword "(") .>>. preterm .>>. a (Resword ")") >> (snd << fst)
    <|> a (Resword "if") .>>. preterm .>>. a (Resword "then") .>>. preterm .>>. a (Resword "else") .>>. preterm >> lmk_ite
    <|> a (Resword "[") .>>. elistof preterm (a (Resword ";")) "term" .>>. a (Resword "]") >> (pmk_list << snd << fst)
    <|> a (Resword "{") .>>.
       (elistof nocommapreterm (a (Ident ",")) "term" .>>.  a (Resword "}") >> lmk_setenum
        <|> preterm .>>. a (Resword "|") .>>. preterm .>>. a (Resword "}") >> lmk_setabs
        <|> preterm .>>. a (Resword "|") .>>. preterm .>>. a (Resword "|") .>>. preterm .>>. a (Resword "}") >> lmk_setcompr) >> snd
    <|> a (Resword "match") .>>. preterm .>>. a (Resword "with") .>>. clauses >> (fun (((_,e),_),c) -> Combp(Combp(Varp("_MATCH",dpty),e),c))
    <|> a (Resword "function") .>>. clauses >> (fun (_,c) -> Combp(Varp("_FUNCTION",dpty),c))
    <|> a (Ident "#") .>>. identifier .>>. possibly (a (Resword ".") .>>. identifier >> snd) >> lmk_decimal
    <|> identifier
      >> (fun s -> Varp(s,dpty))) i
    and pattern i =
      (preterm .>>. possibly (a (Resword "when") .>>. preterm >> snd)) i
    and clause i =
     ((pattern .>>. (a (Resword "->") .>>. preterm >> snd)) >> pmk_pattern) i
    and clauses i =
     ((possibly (a (Resword "|")) .>>.
       listof clause (a (Resword "|")) "pattern-match clause" >> snd) >> end_itlist (fun s t -> Combp(Combp(Varp("_SEQPATTERN",dpty),s),t))) i
    (function
      | [Ident s] -> Varp(s,dpty),[]
      | inp -> preterm inp)
  
  (* ------------------------------------------------------------------------- *)
  (* Type and term parsers.                                                    *)
  