Project

General

Profile

« Previous | Next » 

Revision 66359a5e

Added by Pierre-Loïc Garoche about 7 years ago

[general] large modification: added machine types, a second typing phase dealing with machine types (eg uint8)
typing was transformed as a functor and parametrized by basic types (int/real/bool)
it can also be applied multiple times on the same program

View differences:

src/printers.ml
80 80
    | Const_string s -> pp_print_string fmt ("\"" ^ s ^ "\"")
81 81

  
82 82

  
83
let pp_annot_key fmt kwds =
84
  match kwds with
85
  | [] -> assert false
86
  | [x] -> Format.pp_print_string fmt x
87
  | _ -> Format.fprintf fmt "/%a/" (fprintf_list ~sep:"/" Format.pp_print_string) kwds
88

  
83 89
let rec pp_expr fmt expr =
84 90
  (match expr.expr_annot with 
85 91
  | None -> fprintf fmt "%t" 
......
164 170

  
165 171
and pp_expr_annot fmt expr_ann =
166 172
  let pp_annot fmt (kwds, ee) =
167
    Format.fprintf fmt "(*! %t: %a; *)"
168
      (fun fmt -> match kwds with | [] -> assert false | [x] -> Format.pp_print_string fmt x | _ -> Format.fprintf fmt "/%a/" (fprintf_list ~sep:"/" Format.pp_print_string) kwds)
173
    Format.fprintf fmt "(*! %a: %a; *)"
174
      pp_annot_key kwds
169 175
      pp_eexpr ee
170 176
  in
171 177
  fprintf_list ~sep:"@ " pp_annot fmt expr_ann.annots

Also available in: Unified diff