src/Pure/Syntax/type_ext.ML
author wenzelm
Tue, 05 Apr 2011 13:07:40 +0200
changeset 42223 098c86e53153
parent 42204 b3277168c1e7
child 42242 39261908e12f
permissions -rw-r--r--
more precise propagation of reports/results through some inner syntax layers; misc reorganization;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
     1
(*  Title:      Pure/Syntax/type_ext.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
     4
Utilities for input and output of types.  The concrete syntax of types.
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
signature TYPE_EXT0 =
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
     8
sig
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
     9
  val sort_of_term: term -> sort
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    10
  val term_sorts: term -> (indexname * sort) list
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    11
  val typ_of_term: (indexname -> sort) -> term -> typ
42053
006095137a81 update_name_tr: more precise handling of explicit constraints, including positions;
wenzelm
parents: 42052
diff changeset
    12
  val is_position: term -> bool
42050
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
    13
  val strip_positions: term -> term
42052
34f1d2d81284 statespace syntax: strip positions -- type constraints are unexpected here;
wenzelm
parents: 42050
diff changeset
    14
  val strip_positions_ast: Ast.ast -> Ast.ast
42134
4bc55652c685 tuned signatures;
wenzelm
parents: 42133
diff changeset
    15
  type term_context
42223
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
    16
  val decode_term: term_context ->
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
    17
    Position.reports * term Exn.result -> Position.reports * term Exn.result
6901
5e20ddfdf3c7 export term_of_typ;
wenzelm
parents: 5690
diff changeset
    18
  val term_of_typ: bool -> typ -> term
10572
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
    19
  val no_brackets: unit -> bool
16614
a493a50e6c0a export no_type_brackets;
wenzelm
parents: 15833
diff changeset
    20
  val no_type_brackets: unit -> bool
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    21
end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
signature TYPE_EXT =
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    24
sig
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
  include TYPE_EXT0
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    26
  val term_of_sort: sort -> term
1511
09354d37a5ab Elimination of fully-functorial style.
paulson
parents: 764
diff changeset
    27
  val tappl_ast_tr': Ast.ast * Ast.ast list -> Ast.ast
8895
2913a54e64cf added sort_of_term;
wenzelm
parents: 7500
diff changeset
    28
  val sortT: typ
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36502
diff changeset
    29
  val type_ext: Syn_Ext.syn_ext
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    30
end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36502
diff changeset
    32
structure Type_Ext: TYPE_EXT =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
struct
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    34
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    35
(** input utils **)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
8895
2913a54e64cf added sort_of_term;
wenzelm
parents: 7500
diff changeset
    37
(* sort_of_term *)
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    38
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    39
fun sort_of_term tm =
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    40
  let
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    41
    fun err () = raise TERM ("sort_of_term: bad encoding of classes", [tm]);
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    42
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    43
    fun class s = Lexicon.unmark_class s handle Fail _ => err ();
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    44
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    45
    fun classes (Const (s, _)) = [class s]
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    46
      | classes (Const ("_classes", _) $ Const (s, _) $ cs) = class s :: classes cs
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    47
      | classes _ = err ();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    49
    fun sort (Const ("_topsort", _)) = []
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    50
      | sort (Const (s, _)) = [class s]
3778
b70c41bc7491 fixed raw_term_sorts (again!);
wenzelm
parents: 2699
diff changeset
    51
      | sort (Const ("_sort", _) $ cs) = classes cs
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    52
      | sort _ = err ();
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    53
  in sort tm end;
8895
2913a54e64cf added sort_of_term;
wenzelm
parents: 7500
diff changeset
    54
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    55
22704
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    56
(* term_sorts *)
8895
2913a54e64cf added sort_of_term;
wenzelm
parents: 7500
diff changeset
    57
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    58
fun term_sorts tm =
8895
2913a54e64cf added sort_of_term;
wenzelm
parents: 7500
diff changeset
    59
  let
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    60
    val sort_of = sort_of_term;
22704
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    61
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    62
    fun add_env (Const ("_ofsort", _) $ Free (x, _) $ cs) =
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    63
          insert (op =) ((x, ~1), sort_of cs)
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    64
      | add_env (Const ("_ofsort", _) $ (Const ("_tfree", _) $ Free (x, _)) $ cs) =
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    65
          insert (op =) ((x, ~1), sort_of cs)
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    66
      | add_env (Const ("_ofsort", _) $ Var (xi, _) $ cs) =
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    67
          insert (op =) (xi, sort_of cs)
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    68
      | add_env (Const ("_ofsort", _) $ (Const ("_tvar", _) $ Var (xi, _)) $ cs) =
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    69
          insert (op =) (xi, sort_of cs)
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    70
      | add_env (Abs (_, _, t)) = add_env t
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    71
      | add_env (t1 $ t2) = add_env t1 #> add_env t2
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
    72
      | add_env _ = I;
8895
2913a54e64cf added sort_of_term;
wenzelm
parents: 7500
diff changeset
    73
  in add_env tm [] end;
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    74
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    75
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    76
(* typ_of_term *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    78
fun typ_of_term get_sort tm =
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    79
  let
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    80
    fun err () = raise TERM ("typ_of_term: bad encoding of type", [tm]);
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    81
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    82
    fun typ_of (Free (x, _)) = TFree (x, get_sort (x, ~1))
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    83
      | typ_of (Var (xi, _)) = TVar (xi, get_sort xi)
32784
1a5dde5079ac eliminated redundant bindings;
wenzelm
parents: 30364
diff changeset
    84
      | typ_of (Const ("_tfree",_) $ (t as Free _)) = typ_of t
1a5dde5079ac eliminated redundant bindings;
wenzelm
parents: 30364
diff changeset
    85
      | typ_of (Const ("_tvar",_) $ (t as Var _)) = typ_of t
12317
fed7bed97293 support "_::foo" sort constraints;
wenzelm
parents: 11312
diff changeset
    86
      | typ_of (Const ("_ofsort", _) $ Free (x, _) $ _) = TFree (x, get_sort (x, ~1))
16614
a493a50e6c0a export no_type_brackets;
wenzelm
parents: 15833
diff changeset
    87
      | typ_of (Const ("_ofsort", _) $ (Const ("_tfree",_) $ Free (x, _)) $ _) =
a493a50e6c0a export no_type_brackets;
wenzelm
parents: 15833
diff changeset
    88
          TFree (x, get_sort (x, ~1))
12317
fed7bed97293 support "_::foo" sort constraints;
wenzelm
parents: 11312
diff changeset
    89
      | typ_of (Const ("_ofsort", _) $ Var (xi, _) $ _) = TVar (xi, get_sort xi)
16614
a493a50e6c0a export no_type_brackets;
wenzelm
parents: 15833
diff changeset
    90
      | typ_of (Const ("_ofsort", _) $ (Const ("_tvar",_) $ Var (xi, _)) $ _) =
a493a50e6c0a export no_type_brackets;
wenzelm
parents: 15833
diff changeset
    91
          TVar (xi, get_sort xi)
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    92
      | typ_of (Const ("_dummy_ofsort", _) $ t) = TFree ("'_dummy_", sort_of_term t)
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    93
      | typ_of t =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    94
          let
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    95
            val (head, args) = Term.strip_comb t;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    96
            val a =
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    97
              (case head of
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    98
                Const (c, _) => (Lexicon.unmark_type c handle Fail _ => err ())
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    99
              | _ => err ());
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   100
          in Type (a, map typ_of args) end;
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   101
  in typ_of tm end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
42050
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   104
(* positions *)
22704
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
   105
42131
1d9710ff7209 decode_term/disambig: report resolved term variables for the unique (!) result;
wenzelm
parents: 42053
diff changeset
   106
fun decode_position (Free (x, _)) = Lexicon.decode_position x
1d9710ff7209 decode_term/disambig: report resolved term variables for the unique (!) result;
wenzelm
parents: 42053
diff changeset
   107
  | decode_position _ = NONE;
1d9710ff7209 decode_term/disambig: report resolved term variables for the unique (!) result;
wenzelm
parents: 42053
diff changeset
   108
1d9710ff7209 decode_term/disambig: report resolved term variables for the unique (!) result;
wenzelm
parents: 42053
diff changeset
   109
val is_position = is_some o decode_position;
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39288
diff changeset
   110
42050
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   111
fun strip_positions ((t as Const (c, _)) $ u $ v) =
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   112
      if (c = "_constrain" orelse c = "_constrainAbs") andalso is_position v
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   113
      then strip_positions u
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   114
      else t $ strip_positions u $ strip_positions v
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   115
  | strip_positions (t $ u) = strip_positions t $ strip_positions u
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   116
  | strip_positions (Abs (x, T, t)) = Abs (x, T, strip_positions t)
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   117
  | strip_positions t = t;
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   118
42052
34f1d2d81284 statespace syntax: strip positions -- type constraints are unexpected here;
wenzelm
parents: 42050
diff changeset
   119
fun strip_positions_ast (Ast.Appl ((t as Ast.Constant c) :: u :: (v as Ast.Variable x) :: asts)) =
34f1d2d81284 statespace syntax: strip positions -- type constraints are unexpected here;
wenzelm
parents: 42050
diff changeset
   120
      if (c = "_constrain" orelse c = "_constrainAbs") andalso is_some (Lexicon.decode_position x)
34f1d2d81284 statespace syntax: strip positions -- type constraints are unexpected here;
wenzelm
parents: 42050
diff changeset
   121
      then Ast.mk_appl (strip_positions_ast u) (map strip_positions_ast asts)
34f1d2d81284 statespace syntax: strip positions -- type constraints are unexpected here;
wenzelm
parents: 42050
diff changeset
   122
      else Ast.Appl (map strip_positions_ast (t :: u :: v :: asts))
34f1d2d81284 statespace syntax: strip positions -- type constraints are unexpected here;
wenzelm
parents: 42050
diff changeset
   123
  | strip_positions_ast (Ast.Appl asts) = Ast.Appl (map strip_positions_ast asts)
34f1d2d81284 statespace syntax: strip positions -- type constraints are unexpected here;
wenzelm
parents: 42050
diff changeset
   124
  | strip_positions_ast ast = ast;
34f1d2d81284 statespace syntax: strip positions -- type constraints are unexpected here;
wenzelm
parents: 42050
diff changeset
   125
42050
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   126
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   127
(* decode_term -- transform parse tree into raw term *)
5a505dfec04e datatype case_tr: strip positions -- type constraints are unexpected despite the "any" category in "case_syn";
wenzelm
parents: 42048
diff changeset
   128
42133
74479999cf25 decode_term: more precise reports;
wenzelm
parents: 42131
diff changeset
   129
fun markup_bound def id =
42170
a37a47aa985b more informative markup_free;
wenzelm
parents: 42135
diff changeset
   130
  [Markup.properties [(if def then Markup.defN else Markup.refN, id)] Markup.bound];
42131
1d9710ff7209 decode_term/disambig: report resolved term variables for the unique (!) result;
wenzelm
parents: 42053
diff changeset
   131
42134
4bc55652c685 tuned signatures;
wenzelm
parents: 42133
diff changeset
   132
type term_context =
4bc55652c685 tuned signatures;
wenzelm
parents: 42133
diff changeset
   133
 {get_sort: (indexname * sort) list -> indexname -> sort,
4bc55652c685 tuned signatures;
wenzelm
parents: 42133
diff changeset
   134
  get_const: string -> bool * string,
42135
da200fa2768c decode_term: some context-sensitive markup;
wenzelm
parents: 42134
diff changeset
   135
  get_free: string -> string option,
42170
a37a47aa985b more informative markup_free;
wenzelm
parents: 42135
diff changeset
   136
  markup_const: string -> Markup.T list,
a37a47aa985b more informative markup_free;
wenzelm
parents: 42135
diff changeset
   137
  markup_free: string -> Markup.T list,
a37a47aa985b more informative markup_free;
wenzelm
parents: 42135
diff changeset
   138
  markup_var: indexname -> Markup.T list};
42134
4bc55652c685 tuned signatures;
wenzelm
parents: 42133
diff changeset
   139
42223
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   140
fun decode_term _ (result as (_: Position.reports, Exn.Exn _)) = result
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   141
  | decode_term (term_context: term_context) (reports0, Exn.Result tm) =
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   142
      let
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   143
        val {get_sort, get_const, get_free, markup_const, markup_free, markup_var} = term_context;
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   144
        val decodeT = typ_of_term (get_sort (term_sorts tm));
22704
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
   145
42223
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   146
        val reports = Unsynchronized.ref reports0;
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   147
        fun report ps = Position.reports reports ps;
42131
1d9710ff7209 decode_term/disambig: report resolved term variables for the unique (!) result;
wenzelm
parents: 42053
diff changeset
   148
42223
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   149
        fun decode ps qs bs (Const ("_constrain", _) $ t $ typ) =
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   150
              (case decode_position typ of
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   151
                SOME p => decode (p :: ps) qs bs t
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   152
              | NONE => Type.constraint (decodeT typ) (decode ps qs bs t))
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   153
          | decode ps qs bs (Const ("_constrainAbs", _) $ t $ typ) =
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   154
              (case decode_position typ of
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   155
                SOME q => decode ps (q :: qs) bs t
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   156
              | NONE => Type.constraint (decodeT typ --> dummyT) (decode ps qs bs t))
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   157
          | decode _ qs bs (Abs (x, T, t)) =
42131
1d9710ff7209 decode_term/disambig: report resolved term variables for the unique (!) result;
wenzelm
parents: 42053
diff changeset
   158
              let
42223
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   159
                val id = serial_string ();
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   160
                val _ = report qs (markup_bound true) id;
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   161
              in Abs (x, T, decode [] [] (id :: bs) t) end
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   162
          | decode _ _ bs (t $ u) = decode [] [] bs t $ decode [] [] bs u
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   163
          | decode ps _ _ (Const (a, T)) =
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   164
              (case try Lexicon.unmark_fixed a of
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   165
                SOME x => (report ps markup_free x; Free (x, T))
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   166
              | NONE =>
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   167
                  let
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   168
                    val c =
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   169
                      (case try Lexicon.unmark_const a of
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   170
                        SOME c => c
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   171
                      | NONE => snd (get_const a));
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   172
                    val _ = report ps markup_const c;
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   173
                  in Const (c, T) end)
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   174
          | decode ps _ _ (Free (a, T)) =
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   175
              (case (get_free a, get_const a) of
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   176
                (SOME x, _) => (report ps markup_free x; Free (x, T))
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   177
              | (_, (true, c)) => (report ps markup_const c; Const (c, T))
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   178
              | (_, (false, c)) =>
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   179
                  if Long_Name.is_qualified c
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   180
                  then (report ps markup_const c; Const (c, T))
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   181
                  else (report ps markup_free c; Free (c, T)))
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   182
          | decode ps _ _ (Var (xi, T)) = (report ps markup_var xi; Var (xi, T))
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   183
          | decode ps _ bs (t as Bound i) =
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   184
              (case try (nth bs) i of
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   185
                SOME id => (report ps (markup_bound false) id; t)
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   186
              | NONE => t);
42131
1d9710ff7209 decode_term/disambig: report resolved term variables for the unique (!) result;
wenzelm
parents: 42053
diff changeset
   187
42223
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   188
        val tm' = Exn.interruptible_capture (fn () => decode [] [] [] tm) ();
098c86e53153 more precise propagation of reports/results through some inner syntax layers;
wenzelm
parents: 42204
diff changeset
   189
      in (! reports, tm') end;
22704
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
   190
f67607c3e56e added decode_types (from type_infer.ML);
wenzelm
parents: 20854
diff changeset
   191
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   192
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   193
(** output utils **)
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   194
2699
932fae4271d7 term_of_... now mark class, tfree, tvar;
wenzelm
parents: 2678
diff changeset
   195
(* term_of_sort *)
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   196
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   197
fun term_of_sort S =
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   198
  let
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   199
    val class = Lexicon.const o Lexicon.mark_class;
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   200
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   201
    fun classes [c] = class c
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   202
      | classes (c :: cs) = Lexicon.const "_classes" $ class c $ classes cs;
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   203
  in
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   204
    (case S of
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   205
      [] => Lexicon.const "_topsort"
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   206
    | [c] => class c
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   207
    | cs => Lexicon.const "_sort" $ classes cs)
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   208
  end;
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   209
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   210
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   211
(* term_of_typ *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   212
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   213
fun term_of_typ show_sorts ty =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   214
  let
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   215
    fun of_sort t S =
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   216
      if show_sorts then Lexicon.const "_ofsort" $ t $ term_of_sort S
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   217
      else t;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   218
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   219
    fun term_of (Type (a, Ts)) =
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   220
          Term.list_comb (Lexicon.const (Lexicon.mark_type a), map term_of Ts)
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39288
diff changeset
   221
      | term_of (TFree (x, S)) =
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39288
diff changeset
   222
          if is_some (Lexicon.decode_position x) then Lexicon.free x
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39288
diff changeset
   223
          else of_sort (Lexicon.const "_tfree" $ Lexicon.free x) S
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   224
      | term_of (TVar (xi, S)) = of_sort (Lexicon.const "_tvar" $ Lexicon.var xi) S;
8895
2913a54e64cf added sort_of_term;
wenzelm
parents: 7500
diff changeset
   225
  in term_of ty end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   226
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   227
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   228
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   229
(** the type syntax **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   230
10572
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   231
(* print mode *)
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   232
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   233
val bracketsN = "brackets";
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   234
val no_bracketsN = "no_brackets";
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   235
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   236
fun no_brackets () =
24613
bc889c3d55a3 added print_mode_value (CRITICAL);
wenzelm
parents: 23167
diff changeset
   237
  find_first (fn mode => mode = bracketsN orelse mode = no_bracketsN)
bc889c3d55a3 added print_mode_value (CRITICAL);
wenzelm
parents: 23167
diff changeset
   238
    (print_mode_value ()) = SOME no_bracketsN;
11312
4104bd8d1528 added (no)_type_brackets
nipkow
parents: 10572
diff changeset
   239
4104bd8d1528 added (no)_type_brackets
nipkow
parents: 10572
diff changeset
   240
val type_bracketsN = "type_brackets";
4104bd8d1528 added (no)_type_brackets
nipkow
parents: 10572
diff changeset
   241
val no_type_bracketsN = "no_type_brackets";
4104bd8d1528 added (no)_type_brackets
nipkow
parents: 10572
diff changeset
   242
4104bd8d1528 added (no)_type_brackets
nipkow
parents: 10572
diff changeset
   243
fun no_type_brackets () =
24613
bc889c3d55a3 added print_mode_value (CRITICAL);
wenzelm
parents: 23167
diff changeset
   244
  find_first (fn mode => mode = type_bracketsN orelse mode = no_type_bracketsN)
bc889c3d55a3 added print_mode_value (CRITICAL);
wenzelm
parents: 23167
diff changeset
   245
    (print_mode_value ()) <> SOME type_bracketsN;
10572
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   246
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   247
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   248
(* parse ast translations *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
42204
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   250
fun tapp_ast_tr [ty, c] = Ast.Appl [c, ty]
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   251
  | tapp_ast_tr asts = raise Ast.AST ("tapp_ast_tr", asts);
347
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   252
42204
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   253
fun tappl_ast_tr [ty, tys, c] = Ast.mk_appl c (ty :: Ast.unfold_ast "_types" tys)
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   254
  | tappl_ast_tr asts = raise Ast.AST ("tappl_ast_tr", asts);
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   255
42204
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   256
fun bracket_ast_tr [dom, cod] = Ast.fold_ast_p "\\<^type>fun" (Ast.unfold_ast "_types" dom, cod)
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   257
  | bracket_ast_tr asts = raise Ast.AST ("bracket_ast_tr", asts);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   258
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   259
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   260
(* print ast translations *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   261
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   262
fun tappl_ast_tr' (f, []) = raise Ast.AST ("tappl_ast_tr'", [f])
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   263
  | tappl_ast_tr' (f, [ty]) = Ast.Appl [Ast.Constant "_tapp", ty, f]
347
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   264
  | tappl_ast_tr' (f, ty :: tys) =
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   265
      Ast.Appl [Ast.Constant "_tappl", ty, Ast.fold_ast "_types" tys, f];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   266
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   267
fun fun_ast_tr' (*"\\<^type>fun"*) asts =
16614
a493a50e6c0a export no_type_brackets;
wenzelm
parents: 15833
diff changeset
   268
  if no_brackets () orelse no_type_brackets () then raise Match
10572
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   269
  else
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   270
    (case Ast.unfold_ast_p "\\<^type>fun" (Ast.Appl (Ast.Constant "\\<^type>fun" :: asts)) of
10572
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   271
      (dom as _ :: _ :: _, cod)
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   272
        => Ast.Appl [Ast.Constant "_bracket", Ast.fold_ast "_types" dom, cod]
b070825579b8 no_brackets mode;
wenzelm
parents: 9067
diff changeset
   273
    | _ => raise Match);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   274
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   275
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   276
(* type_ext *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   277
42204
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   278
fun typ c = Type (c, []);
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   279
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   280
val class_nameT = typ "class_name";
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   281
val type_nameT = typ "type_name";
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   282
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   283
val sortT = typ "sort";
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   284
val classesT = typ "classes";
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   285
val typesT = typ "types";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   286
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36502
diff changeset
   287
local open Lexicon Syn_Ext in
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   288
35668
69e1740fbfb1 simplified Syntax.basic_syntax (again);
wenzelm
parents: 35433
diff changeset
   289
val type_ext = syn_ext' false (K false)
347
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   290
  [Mfix ("_",           tidT --> typeT,                "", [], max_pri),
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   291
   Mfix ("_",           tvarT --> typeT,               "", [], max_pri),
42204
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   292
   Mfix ("_",           type_nameT --> typeT,          "", [], max_pri),
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   293
   Mfix ("_",           idT --> type_nameT,            "_type_name", [], max_pri),
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   294
   Mfix ("_",           longidT --> type_nameT,        "_type_name", [], max_pri),
330
2fda15dd1e0f changed the way a grammar is generated to allow the new parser to work;
clasohm
parents: 258
diff changeset
   295
   Mfix ("_::_",        [tidT, sortT] ---> typeT,      "_ofsort", [max_pri, 0], max_pri),
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   296
   Mfix ("_::_",        [tvarT, sortT] ---> typeT,     "_ofsort", [max_pri, 0], max_pri),
14838
b12855d44c97 tuned _dummy_ofsort syntax;
wenzelm
parents: 14255
diff changeset
   297
   Mfix ("'_()::_",     sortT --> typeT,               "_dummy_ofsort", [0], max_pri),
42204
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   298
   Mfix ("_",           class_nameT --> sortT,         "", [], max_pri),
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   299
   Mfix ("_",           idT --> class_nameT,           "_class_name", [], max_pri),
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   300
   Mfix ("_",           longidT --> class_nameT,       "_class_name", [], max_pri),
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   301
   Mfix ("{}",          sortT,                         "_topsort", [], max_pri),
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   302
   Mfix ("{_}",         classesT --> sortT,            "_sort", [], max_pri),
42204
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   303
   Mfix ("_",           class_nameT --> classesT,      "", [], max_pri),
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   304
   Mfix ("_,_",         [class_nameT, classesT] ---> classesT, "_classes", [], max_pri),
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   305
   Mfix ("_ _",         [typeT, type_nameT] ---> typeT, "_tapp", [max_pri, 0], max_pri),
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   306
   Mfix ("((1'(_,/ _')) _)", [typeT, typesT, type_nameT] ---> typeT, "_tappl", [], max_pri),
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   307
   Mfix ("_",           typeT --> typesT,              "", [], max_pri),
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   308
   Mfix ("_,/ _",       [typeT, typesT] ---> typesT,   "_types", [], max_pri),
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   309
   Mfix ("(_/ => _)",   [typeT, typeT] ---> typeT,     "\\<^type>fun", [1, 0], 0),
624
33b9b5da3e6f made major changes to grammar;
clasohm
parents: 557
diff changeset
   310
   Mfix ("([_]/ => _)", [typesT, typeT] ---> typeT,    "_bracket", [0, 0], 0),
2678
d5fe793293ac added "_" syntax for dummyT;
wenzelm
parents: 2584
diff changeset
   311
   Mfix ("'(_')",       typeT --> typeT,               "", [0], max_pri),
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   312
   Mfix ("'_",          typeT,                         "\\<^type>dummy", [], max_pri)]
35433
73cc288b4f83 "_type_prop" is syntax const -- recovered printing of OFCLASS;
wenzelm
parents: 35429
diff changeset
   313
  ["_type_prop"]
42204
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   314
  (map Syn_Ext.mk_trfun
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   315
    [("_tapp", K tapp_ast_tr), ("_tappl", K tappl_ast_tr), ("_bracket", K bracket_ast_tr)],
b3277168c1e7 added Position.reports convenience;
wenzelm
parents: 42170
diff changeset
   316
   [], [], map Syn_Ext.mk_trfun [("\\<^type>fun", K fun_ast_tr')])
26708
fc2e7d2f763d moved default token translations to proof_context.ML, if all fails the pretty printer falls back on plain output;
wenzelm
parents: 26039
diff changeset
   317
  []
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   318
  ([], []);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   319
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   320
end;
5690
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   321
4b056ee5435c no open;
wenzelm
parents: 3829
diff changeset
   322
end;