X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_notation%2FgrafiteAstPp.ml;h=b7a62476cf26b05a9c3d52d4a426aadca0604c7b;hb=cd602bc57c4ceba6188b4cac0dbf5dad8f5df7b6;hp=db7a7253e30888f1a913d66a738ccc9b52806b39;hpb=e20f3963028a966fc93ba0d611c4aa8341d20e2c;p=helm.git diff --git a/helm/ocaml/cic_notation/grafiteAstPp.ml b/helm/ocaml/cic_notation/grafiteAstPp.ml index db7a7253e..b7a62476c 100644 --- a/helm/ocaml/cic_notation/grafiteAstPp.ml +++ b/helm/ocaml/cic_notation/grafiteAstPp.ml @@ -229,6 +229,34 @@ let pp_obj = function "record " ^ name ^ " " ^ pp_params params ^ " \\def {" ^ pp_fields fields ^ "}" +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 rec pp_cic_appl_pattern = function + | CicNotationPt.UriPattern uri -> UriManager.string_of_uri uri + | CicNotationPt.VarPattern name -> name + | CicNotationPt.ImplicitPattern -> "_" + | CicNotationPt.ApplPattern aps -> + sprintf "(%s)" (String.concat " " (List.map pp_cic_appl_pattern aps)) + +let pp_l1_pattern = CicNotationPp.pp_term +let pp_l2_pattern = CicNotationPp.pp_term + +let pp_associativity = function + | Some Gramext.LeftA -> "left associative " + | Some Gramext.RightA -> "right associative " + | Some Gramext.NonA -> "non associative " + | None -> "" + +let pp_precedence = function + | Some i -> sprintf "with precedence %d " i + | None -> "" + let pp_command = function | Include (_,path) -> "include " ^ path | Qed _ -> "qed" @@ -240,6 +268,19 @@ let pp_command = function | Default (_,what,uris) -> sprintf "default \"%s\" %s" what (String.concat " " (List.map UriManager.string_of_uri uris)) + | 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)) + (pp_cic_appl_pattern cic_appl_pattern) + | Notation (_, l1_pattern, assoc, prec, l2_pattern) -> + sprintf "notation \"%s\" %s%sfor %s" + (pp_l1_pattern l1_pattern) + (pp_associativity assoc) + (pp_precedence prec) + (pp_l2_pattern l2_pattern) + | Render _ + | Dump _ -> assert false (* ZACK: debugging *) let rec pp_tactical = function | Tactic (_, tac) -> pp_tactic tac @@ -277,7 +318,12 @@ let pp_cic_command = function | Qed _ -> "qed" | Drop _ -> "drop" | Coercion (_,term) -> sprintf "coercion %s" (CicPp.ppterm term) - | Set (_, _, _) - | Alias (_,_) - | Default (_,_,_) - | Obj (_,_) -> assert false (* not implemented *) + | Set _ + | Alias _ + | Default _ + | Render _ + | Dump _ + | Interpretation _ + | Notation _ + | Obj _ -> assert false (* not implemented *) +