]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_transformations/tacticAstPp.ml
Got rid of a few warnings.
[helm.git] / helm / ocaml / cic_transformations / tacticAstPp.ml
index 1a28fa578004b6d0a71b3df0ceea1ab9e7a1aee2..822618eb4a18d0c70616086f287ccb21d4f438fb 100644 (file)
@@ -29,6 +29,7 @@ open TacticAst
 
 let tactical_terminator = "."
 let tactic_terminator = tactical_terminator
+let command_terminator = tactical_terminator
 let tactical_separator = ";"
 
 let pp_term_ast term = CicAstPp.pp_term term
@@ -40,6 +41,7 @@ let pp_reduction_kind = function
   | `Reduce -> "reduce"
   | `Simpl -> "simplify"
   | `Whd -> "whd"
+  | `Normalize -> "normalize"
 
 let rec pp_tactic = function
   | Absurd (_, term) -> "absurd" ^ pp_term_ast term
@@ -65,7 +67,6 @@ let rec pp_tactic = function
       sprintf "fold %s %s" (pp_reduction_kind kind) (pp_term_ast term)
   | Goal (_, n) -> "goal " ^ string_of_int n
   | Fourier _ -> "fourier"
-  | Hint _ -> "hint"
   | Injection (_, ident) -> "injection " ^ ident
   | Intros (_, None, []) -> "intro"
   | Intros (_, num, idents) ->
@@ -84,11 +85,17 @@ let rec pp_tactic = function
   | Reduce (_, kind, Some (terms, `Everywhere)) ->
       sprintf "%s in hyp %s" (pp_reduction_kind kind)
         (String.concat ", " (List.map pp_term_ast terms))
+  | ReduceAt (_, kind, id, term) ->
+      sprintf "%s %s at %s" (pp_reduction_kind kind) id
+       (pp_term_ast term)
   | Reflexivity _ -> "reflexivity"
   | Replace (_, t1, t2) ->
       sprintf "replace %s with %s" (pp_term_ast t1) (pp_term_ast t2)
   | Replace_pattern (_, _, _) -> assert false  (* TODO *)
-  | Rewrite (_, _, _, _) -> assert false (* TODO *)
+  | Rewrite (_, pos, t, None) -> 
+      sprintf "rewrite %s %s" 
+        (if pos = `Left then "left" else "right") (pp_term_ast t)
+  | Rewrite _ -> assert false (* TODO *)
   | Right _ -> "right"
   | Ring _ -> "ring"
   | Split _ -> "split"
@@ -110,16 +117,24 @@ let pp_search_kind = function
   | `Elim -> "elim"
 
 let pp_macro pp_term = function 
-  | Abort _ -> "Abort"
+  (* Whelp *)
+  | WInstance (_, term) -> "whelp instance " ^ pp_term term
+  | WHint (_, t) -> "whelp hint " ^ pp_term t
+  | WLocate (_, s) -> "whelp locate " ^ s
+  | WElim (_, t) -> "whelp elim " ^ pp_term t
+  | WMatch (_, term) -> "whelp match " ^ pp_term term
+  (* real macros *)
+(*   | Abort _ -> "Abort" *)
   | Check (_, term) -> sprintf "Check %s" (pp_term term)
-  | Redo (_, None) -> "Redo"
-  | Redo (_, Some n) -> sprintf "Redo %d" n
+  | Hint _ -> "hint"
+(*   | Redo (_, None) -> "Redo"
+  | Redo (_, Some n) -> sprintf "Redo %d" n *)
   | Search_pat (_, kind, pat) ->
       sprintf "search %s \"%s\"" (pp_search_kind kind) pat
   | Search_term (_, kind, term) ->
       sprintf "search %s %s" (pp_search_kind kind) (pp_term term)
-  | Undo (_, None) -> "Undo"
-  | Undo (_, Some n) -> sprintf "Undo %d" n
+(*   | Undo (_, None) -> "Undo"
+  | Undo (_, Some n) -> sprintf "Undo %d" n *)
   | Print (_, name) -> sprintf "Print \"%s\"" name
   | Quit _ -> "Quit"
 
@@ -135,7 +150,7 @@ let pp_alias = function
       sprintf "alias num (instance %d) = \"%s\"" instance desc
   
 let pp_command = function
-  | Qed _ -> "Qed"
+  | Qed _ -> "qed"
   | Set (_, name, value) -> sprintf "Set \"%s\" \"%s\"" name value
   | Inductive (_, params, types) ->
       let pp_params = function
@@ -194,4 +209,17 @@ and pp_tacticals tacs =
 
 let pp_tactical tac = pp_tactical tac ^ tactical_terminator
 let pp_tactic tac = pp_tactic tac ^ tactic_terminator
-
+let pp_command tac = pp_command tac ^ command_terminator
+
+let pp_executable = function
+  | Macro (_,x) -> pp_macro_ast x
+  | Tactical (_,x) -> pp_tactical x
+  | Command (_,x) -> pp_command x
+                      
+let pp_comment = function
+  | Note (_,str) -> sprintf "(* %s *)" str
+  | Code (_,code) -> sprintf "(** %s. **)" (pp_executable code)
+
+let pp_statement = function
+  | Executable (_, ex) -> pp_executable ex
+  | Comment (_, c) -> pp_comment c