main.mli 1.1 KB

1234567891011121314151617181920
  1. (** Main module, parses command-line arguments and cycles through phases. *)
  2. (** [Pervasives.exit (]{!main} [())] is executed at the bottom of the file. *)
  3. (** Main function of a phase. Each phase exports a function of this signature
  4. that is called by the {!main}. *)
  5. type phase_func = Types.intermediate -> Types.intermediate
  6. (** List of all phases as
  7. [(identifier, phase_function, condition, description)]. [identifier] is used
  8. for the [-upto] command-line argument, which is saved in
  9. {!Globals.args}([.endphase]). [description] is used for logging, and for the
  10. usage message of [-upto]. *)
  11. val phases : (string * phase_func * (unit -> bool) * string) list
  12. (** Main function, returns exit status. Parses command-line arguments, saving
  13. them in {!Globals.args}. Then all phases are executed successively. Run
  14. [./civicc -help] in a terminal to see the available command-line options.
  15. This function catches the exceptions defined in {!Types}, and prints error
  16. messages accordingly. In case of error, 1 is returned, otherwise 0. *)
  17. val main : unit -> int