append_tail ~tail (Box.Object([],rhs))]) in
let plbox =
match pl with
- [] -> append_tail ~tail (Box.Text([],"[]"))
+ | [] -> append_tail ~tail (Box.Text([],"[]"))
+ | [r] -> (make_rule ~tail:("]" :: tail) "[" r)
| r::tl ->
Box.V([],
(make_rule ~tail:[] "[" r) ::
*)
| Coercion of loc * 'term
| Alias of loc * alias_spec
+ (** parameters, name, type, fields *)
+ | Record of loc * (string * 'term) list * string * 'term * (string * 'term) list
type ('term, 'ident) tactical =
| Tactic of loc * ('term, 'ident) tactic
| `Simpl -> "simplify"
| `Whd -> "whd"
| `Normalize -> "normalize"
-
+
let rec pp_tactic = function
| Absurd (_, term) -> "absurd" ^ pp_term_ast term
| Apply (_, term) -> "apply " ^ pp_term_ast term
| Number_alias (instance,desc) ->
sprintf "alias num (instance %d) = \"%s\"" instance desc
+let pp_params = function
+ | [] -> ""
+ | params ->
+ " " ^
+ String.concat " "
+ (List.map
+ (fun (name, typ) -> sprintf "(%s:%s)" name (pp_term_ast typ))
+ params)
+
+let pp_fields fields =
+ (if fields <> [] then "\n" else "") ^
+ String.concat ";\n"
+ (List.map (fun (name,ty) -> " " ^ name ^ ": " ^ pp_term_ast ty) fields)
+
let pp_command = function
| Qed _ -> "qed"
| Set (_, name, value) -> sprintf "Set \"%s\" \"%s\"" name value
| Inductive (_, params, types) ->
- let pp_params = function
- | [] -> ""
- | params ->
- " " ^
- String.concat " "
- (List.map
- (fun (name, typ) -> sprintf "(%s:%s)" name (pp_term_ast typ))
- params)
- in
let pp_constructors constructors =
String.concat "\n"
(List.map (fun (name, typ) -> sprintf "| %s: %s" name (pp_term_ast typ))
| Some body -> "\\def " ^ pp_term_ast body)
| Coercion (_,_) -> "Coercion IMPLEMENT ME!!!!!"
| Alias (_,s) -> pp_alias s
+ | Record (_,params,name,ty,fields) ->
+ "record " ^ name ^ " " ^ pp_params params ^ " \\def {" ^
+ pp_fields fields ^ "}"
+
let rec pp_tactical = function
| Tactic (_, tac) -> pp_tactic tac