type t = {
  typechecking : typechecking;
  verbose : bool;
  show_evidence : bool;
  input : input;
  output : output;
  target : string option;
}

and typechecking =
  | Nocheck
  | Static
  | Dynamic
  | GradualGuarded
  | GradualMonoClosures
  | GradualMonoValues
  | GradualGuardedDFO
  | GradualMonoDFO
  | GradualSuccinct

and input = Stdin | InputFile of string | InputString of string
and output = Stderr | OutputFile of string

let show_typechecking = function
  | Nocheck -> "no_check"
  | Static -> "static"
  | Dynamic -> "dynamic"
  | GradualGuarded -> "gradual_guarded"
  | GradualMonoClosures -> "gradual_mono_closures"
  | GradualMonoValues -> "gradual_mono_values"
  | GradualGuardedDFO -> "gradual_guarded_dfo"
  | GradualMonoDFO -> "gradual_mono_dfo"
  | GradualSuccinct -> "gradual_succinct"

let cflags (conf : t) =
  let common_cflags = [ "-lm"; "-lgc" ] in
  common_cflags
  @
  match conf.typechecking with
  | GradualMonoDFO -> [ "-DGRADUAL" ]
  | GradualGuardedDFO -> [ "-DGRADUAL_PROXY" ]
  | GradualMonoValues -> [ "-DMONO_VALUES"; "-DMONO_CLOSURES" ]
  | GradualMonoClosures -> [ "-DPROXY_VALUES"; "-DMONO_CLOSURES" ]
  | GradualGuarded -> [ "-DPROXY_VALUES"; "-DPROXY_CLOSURES" ]
  | _ -> []

let runtime_file (conf : t) =
  match conf.typechecking with
  | Static | Nocheck -> "stdlib_untagged.c"
  | Dynamic -> "stdlib_tagged.c"
  | GradualMonoDFO -> "stdlib_gradual.c"
  | GradualSuccinct -> "stdlib_gradual_succinct.c"
  | GradualGuardedDFO -> "stdlib_gradual_proxy.c"
  | GradualMonoValues | GradualMonoClosures | GradualGuarded ->
      "stdlib_combined.c"
