(** Pretty-printers (defined in Caml). *)
Parameter print_Clight: Clight.program -> unit.Parameter print_Cminor: Cminor.program -> unit.Parameter print_RTL: Z -> RTL.program -> unit.Parameter print_LTL: LTL.program -> unit.Parameter print_Mach: Mach.program -> unit.(** * Composing the translation passes *)

(** We first define useful monadic composition operators,
    along with funny (but convenient) notations. *)

Definition apply_total (A B: Type) (x: res A) (f: A -> B) : res B :=
  match x with Error msg => Error msg | OK x1 => OK (f x1) end.Definition apply_partial (A B: Type)
                         (x: res A) (f: A -> res B) : res B :=
  match x with Error msg => Error msg | OK x1 => f x1 end.Notation "a @@@ b" :=
   (apply_partial _ _ a b) (at level 50, left associativity).Notation "a @@ b" :=
   (apply_total _ _ a b) (at level 50, left associativity).Definition print {A: Type} (printer: A -> unit) (prog: A) : A :=
  let unused := printer prog in prog.Definition time {A B: Type} (name: string) (f: A -> B) : A -> B := f.Definition total_if {A: Type}
          (flag: unit -> bool) (f: A -> A) (prog: A) : A :=
  if flag tt then f prog else prog.Definition partial_if {A: Type}
          (flag: unit -> bool) (f: A -> res A) (prog: A) : res A :=
  if flag tt then f prog else OK prog.(** Force [Initializers] and [Cexec] to be extracted as well. *)

Definition transl_init := Initializers.transl_init.Definition cexec_do_step := Cexec.do_step.

(* Specifications: *)
Lemma print_identity: forall (A: Type) (printer: A -> unit) (prog: A), print printer prog = prog.