package archetype

  1. Overview
  2. Docs

Source file printer_whyml.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
open Why3
open Ptree
open Printer_tools

(** grammar : http://why3.lri.fr/doc-1.2.0/syntaxref.html#sec85 *)

let pp_str fmt str =
  Format.fprintf fmt "%s" str

(* -------------------------------------------------------------------------- *)
let pp_ident fmt ident =
  Format.fprintf fmt "%s" ident.id_str

let rec pp_qualid fmt q =
  match q with
  | Qident id ->
    Format.fprintf fmt "%a"
      pp_ident id

  | Qdot (q, id) ->
    Format.fprintf fmt "%a.%a"
      pp_qualid q
      pp_ident id

(* -------------------------------------------------------------------------- *)

let pp_decl fmt decl =
  match decl with
  | Dtype _tds ->
    Format.fprintf fmt "FIXME"

  | Dlogic _lds ->
    Format.fprintf fmt "FIXME"

  | Dind (_ind_sign, _ind_decls) ->
    Format.fprintf fmt "FIXME"

  | Dprop (_prop_kin, _id, _terms) ->
    Format.fprintf fmt "FIXME"

  | Dlet (id, _ghost, _kind, _e) ->
    Format.fprintf fmt "let %a = FIXME"
      pp_ident id

  | Drec _fundefs ->
    Format.fprintf fmt "FIXME"

  | Dexn (_id, _pty, _mask) ->
    Format.fprintf fmt "FIXME"

  | Dmeta (_id, _metargs) ->
    Format.fprintf fmt "FIXME"

  | Dclone (_q, _css) ->
    Format.fprintf fmt "FIXME"

  | Duse q ->
    Format.fprintf fmt "use export %a"
      pp_qualid q

let pp_mlw fmt decls =
  Format.fprintf fmt "%a"
    (pp_list "@\n" pp_decl) decls

(* -------------------------------------------------------------------------- *)
let string_of__of_pp pp x =
  Format.asprintf "%a" pp x

let show_mlw (x : decl list) = string_of__of_pp pp_mlw x