52 val print_syntax: syntax -> unit |
52 val print_syntax: syntax -> unit |
53 val test_read: syntax -> string -> string -> unit |
53 val test_read: syntax -> string -> string -> unit |
54 val read: syntax -> typ -> string -> term list |
54 val read: syntax -> typ -> string -> term list |
55 val read_typ: syntax -> (indexname -> sort) -> string -> typ |
55 val read_typ: syntax -> (indexname -> sort) -> string -> typ |
56 val simple_read_typ: string -> typ |
56 val simple_read_typ: string -> typ |
57 val pretty_term: syntax -> term -> Pretty.T |
57 val pretty_term: bool -> syntax -> term -> Pretty.T |
58 val pretty_typ: syntax -> typ -> Pretty.T |
58 val pretty_typ: syntax -> typ -> Pretty.T |
59 val string_of_term: syntax -> term -> string |
59 val string_of_term: bool -> syntax -> term -> string |
60 val string_of_typ: syntax -> typ -> string |
60 val string_of_typ: syntax -> typ -> string |
61 val simple_string_of_typ: typ -> string |
61 val simple_string_of_typ: typ -> string |
62 val simple_pprint_typ: typ -> pprint_args -> unit |
62 val simple_pprint_typ: typ -> pprint_args -> unit |
63 val ambiguity_level: int ref |
63 val ambiguity_level: int ref |
64 end; |
64 end; |
401 |
401 |
402 |
402 |
403 |
403 |
404 (** pretty terms or typs **) |
404 (** pretty terms or typs **) |
405 |
405 |
406 fun pretty_t t_to_ast pretty_t (syn as Syntax tabs) t = |
406 fun pretty_t t_to_ast pretty_t curried (syn as Syntax tabs) t = |
407 let |
407 let |
408 val {print_trtab, print_ruletab, print_ast_trtab, prtab, ...} = tabs; |
408 val {print_trtab, print_ruletab, print_ast_trtab, prtab, ...} = tabs; |
409 val ast = t_to_ast (lookup_trtab print_trtab) t; |
409 val ast = t_to_ast (lookup_trtab print_trtab) t; |
410 in |
410 in |
411 pretty_t prtab (lookup_trtab print_ast_trtab) |
411 pretty_t curried prtab (lookup_trtab print_ast_trtab) |
412 (normalize_ast (lookup_ruletab print_ruletab) ast) |
412 (normalize_ast (lookup_ruletab print_ruletab) ast) |
413 end; |
413 end; |
414 |
414 |
415 val pretty_term = pretty_t term_to_ast pretty_term_ast; |
415 val pretty_term = pretty_t term_to_ast pretty_term_ast; |
416 val pretty_typ = pretty_t typ_to_ast pretty_typ_ast; |
416 val pretty_typ = pretty_t typ_to_ast pretty_typ_ast false; |
417 |
417 |
418 fun string_of_term syn t = Pretty.string_of (pretty_term syn t); |
418 fun string_of_term curried syn t = |
|
419 Pretty.string_of (pretty_term curried syn t); |
419 fun string_of_typ syn ty = Pretty.string_of (pretty_typ syn ty); |
420 fun string_of_typ syn ty = Pretty.string_of (pretty_typ syn ty); |
420 |
421 |
421 val simple_string_of_typ = string_of_typ type_syn; |
422 val simple_string_of_typ = string_of_typ type_syn; |
422 val simple_pprint_typ = Pretty.pprint o Pretty.quote o (pretty_typ type_syn); |
423 val simple_pprint_typ = Pretty.pprint o Pretty.quote o (pretty_typ type_syn); |
423 |
424 |