* http://helm.cs.unibo.it/
*)
+(* $Id$ *)
+
open Printf
open GrafiteAst
let pp_idents idents = "[" ^ String.concat "; " idents ^ "]"
let pp_reduction_kind ~term_pp = function
+ | `Demodulate -> "demodulate"
| `Normalize -> "normalize"
| `Reduce -> "reduce"
| `Simpl -> "simplify"
| IdTac _ -> "id"
| Injection (_, term) -> "injection " ^ term_pp term
| Intros (_, None, []) -> "intro"
+ | Inversion (_, term) -> "inversion " ^ term_pp term
| Intros (_, num, idents) ->
sprintf "intros%s%s"
(match num with None -> "" | Some num -> " " ^ string_of_int num)
| Print (_, name) -> sprintf "Print \"%s\"" name
| Quit _ -> "Quit"
-let pp_alias = function
- | Ident_alias (id, uri) -> sprintf "alias id \"%s\" = \"%s\"" id uri
- | Symbol_alias (symb, instance, desc) ->
- sprintf "alias symbol \"%s\" (instance %d) = \"%s\""
- symb instance desc
- | Number_alias (instance,desc) ->
- sprintf "alias num (instance %d) = \"%s\"" instance desc
-
-let pp_argument_pattern = function
- | CicNotationPt.IdentArg (eta_depth, name) ->
- let eta_buf = Buffer.create 5 in
- for i = 1 to eta_depth do
- Buffer.add_string eta_buf "\\eta."
- done;
- sprintf "%s%s" (Buffer.contents eta_buf) name
-
-let pp_l1_pattern = CicNotationPp.pp_term
-let pp_l2_pattern = CicNotationPp.pp_term
-
let pp_associativity = function
| Gramext.LeftA -> "left associative"
| Gramext.RightA -> "right associative"
| Some `LeftToRight -> "> "
| Some `RightToLeft -> "< "
-let pp_interpretation dsc symbol arg_patterns cic_appl_pattern =
- sprintf "interpretation \"%s\" '%s %s = %s"
- dsc symbol
- (String.concat " " (List.map pp_argument_pattern arg_patterns))
- (CicNotationPp.pp_cic_appl_pattern cic_appl_pattern)
-
let pp_default what uris =
sprintf "default \"%s\" %s" what
(String.concat " " (List.map UriManager.string_of_uri uris))
-let pp_notation dir_opt l1_pattern assoc prec l2_pattern =
- sprintf "notation %s\"%s\" %s %s for %s"
- (pp_dir_opt dir_opt)
- (pp_l1_pattern l1_pattern)
- (pp_associativity assoc)
- (pp_precedence prec)
- (pp_l2_pattern l2_pattern)
-
let pp_coercion uri do_composites =
sprintf "coercion %s (* %s *)" (UriManager.string_of_uri uri)
(if do_composites then "compounds" else "no compounds")
| Drop _ -> "drop"
| Set (_, name, value) -> sprintf "set \"%s\" \"%s\"" name value
| Coercion (_, uri, do_composites) -> pp_coercion uri do_composites
- | Alias (_,s) -> pp_alias s
| Obj (_,obj) -> obj_pp obj
| Default (_,what,uris) ->
pp_default what uris
- | Interpretation (_, dsc, (symbol, arg_patterns), cic_appl_pattern) ->
- pp_interpretation dsc symbol arg_patterns cic_appl_pattern
- | Notation (_, dir_opt, l1_pattern, assoc, prec, l2_pattern) ->
- pp_notation dir_opt l1_pattern assoc prec l2_pattern
- | Render _
- | Dump _ -> assert false (* ZACK: debugging *)
let rec pp_tactical ~term_pp ~lazy_term_pp =
let pp_tactic = pp_tactic ~lazy_term_pp ~term_pp in
function
| Executable (_, ex) -> pp_executable ~lazy_term_pp ~term_pp ~obj_pp ex
| Comment (_, c) -> pp_comment ~term_pp ~lazy_term_pp ~obj_pp c
-
-let pp_dependency = function
- | IncludeDep str -> "include \"" ^ str ^ "\""
- | BaseuriDep str -> "set \"baseuri\" \"" ^ str ^ "\""
- | UriDep uri -> "uri \"" ^ UriManager.string_of_uri uri ^ "\""
-