OCaml is able to infer types by itself, so what I suggest is that you don't declare any local types, but only the global types (no (a:int) type expressions, but only toplevel type 'a t = 'a -> 'a * 'a). Also, try declaring only some of your types and define only some of your functions at a time (using the toploop, interactive compiler) to see what are the appropriate types the compiler infers.

Besides, you seem to have some errors in the code... for example:

  let succeed f =
      let parse cont stack errors input = cont (stack f) errors input in
      mkparser (End {parse=parse})
  ;;


there is no End constructor declared.

Have fun, Tom