src/Pure/Syntax/type_ext.ML
author wenzelm
Mon, 24 Feb 1997 09:46:12 +0100
changeset 2678 d5fe793293ac
parent 2584 b386951e15e6
child 2699 932fae4271d7
permissions -rw-r--r--
added "_" syntax for dummyT;
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
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
     5
Utilities for input and output of types. Also the concrete syntax of
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
     6
types, which is used to bootstrap Pure.
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
signature TYPE_EXT0 =
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    10
sig
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    11
  val raw_term_sorts: (sort * sort -> bool) -> term -> (indexname * sort) list
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    12
  val typ_of_term: (indexname -> sort) -> term -> typ
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    13
end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
signature TYPE_EXT =
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    16
sig
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
  include TYPE_EXT0
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    18
  val term_of_sort: sort -> term
1511
09354d37a5ab Elimination of fully-functorial style.
paulson
parents: 764
diff changeset
    19
  val term_of_typ: bool -> typ -> term
09354d37a5ab Elimination of fully-functorial style.
paulson
parents: 764
diff changeset
    20
  val tappl_ast_tr': Ast.ast * Ast.ast list -> Ast.ast
09354d37a5ab Elimination of fully-functorial style.
paulson
parents: 764
diff changeset
    21
  val type_ext: SynExt.syn_ext
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    22
end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
1511
09354d37a5ab Elimination of fully-functorial style.
paulson
parents: 764
diff changeset
    24
structure TypeExt : TYPE_EXT =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
struct
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    26
1511
09354d37a5ab Elimination of fully-functorial style.
paulson
parents: 764
diff changeset
    27
open Lexicon SynExt Ast;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    29
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    30
(** input utils **)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    32
(* raw_term_sorts *)
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    33
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    34
fun raw_term_sorts eq_sort tm =
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    35
  let
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
    36
    fun classes (Const (c, _)) = [c]
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
    37
      | classes (Free (c, _)) = [c]
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    38
      | classes (Const ("_classes", _) $ Const (c, _) $ cls) = c :: classes cls
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    39
      | classes (Const ("_classes", _) $ Free (c, _) $ cls) = c :: classes cls
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    40
      | classes tm = raise_term "raw_term_sorts: bad encoding of classes" [tm];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    42
    fun sort (Const ("_topsort", _)) = []
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    43
      | sort (Const (c, _)) = [c]
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    44
      | sort (Free (c, _)) = [c]
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
    45
      | sort (Const ("_sort", _) $ cls) = classes cls
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    46
      | sort tm = raise_term "raw_term_sorts: bad encoding of sort" [tm];
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    47
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    48
    fun eq ((xi, S), (xi', S')) =
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    49
      xi = xi' andalso eq_sort (S, S');
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    50
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    51
    fun env_of (Const ("_ofsort", _) $ Free (x, _) $ cls) = [((x, ~1), sort cls)]
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    52
      | env_of (Const ("_ofsort", _) $ Var (xi, _) $ cls) = [(xi, sort cls)]
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    53
      | env_of (Abs (_, _, t)) = env_of t
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    54
      | env_of (t1 $ t2) = gen_union eq (env_of t1, env_of t2)
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    55
      | env_of t = [];
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    56
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    57
    val env = env_of tm;
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    58
  in
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    59
    (case gen_duplicates eq_fst env of
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    60
      [] => env
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    61
    | dups => error ("Inconsistent sort constraints for type variable(s) " ^
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    62
        commas (map (quote o string_of_vname' o #1) dups)))
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    63
  end;
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    64
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    65
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    66
(* typ_of_term *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    68
fun typ_of_term get_sort t =
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    69
  let
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    70
    fun typ_of (Free (x, _)) =
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    71
          if is_tid x then TFree (x, get_sort (x, ~1))
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    72
          else Type (x, [])
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    73
      | typ_of (Var (xi, _)) = TVar (xi, get_sort xi)
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    74
      | typ_of (Const ("_ofsort", _) $ Free (x, _) $ _) =
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    75
          TFree (x, get_sort (x, ~1))
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    76
      | typ_of (Const ("_ofsort", _) $ Var (xi, _) $ _) =
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    77
          TVar (xi, get_sort xi)
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    78
      | typ_of tm =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    79
          let
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
            val (t, ts) = strip_comb tm;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    81
            val a =
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
    82
              (case t of
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    83
                Const (x, _) => x
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    84
              | Free (x, _) => x
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    85
              | _ => raise_term "typ_of_term: bad encoding of type" [tm]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    86
          in
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    87
            Type (a, map typ_of ts)
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    88
          end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
  in
557
9d386e6c02b7 added raw_term_sorts and changed typ_of_term accordingly (part of fix
wenzelm
parents: 347
diff changeset
    90
    typ_of t
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    91
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    93
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    94
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    95
(** output utils **)
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    96
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    97
(* term_of_sort *)		(* FIXME mark whole sort vs. ind. classes !? *)
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    98
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
    99
fun term_of_sort S =
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   100
  let
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   101
    fun class c = free c;       (* FIXME mark *)
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   102
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   103
    fun classes [] = sys_error "term_of_sort"
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   104
      | classes [c] = class c
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   105
      | classes (c :: cs) = const "_classes" $ class c $ classes cs;
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   106
  in
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   107
    (case S of
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   108
      [] => const "_topsort"
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   109
    | [c] => class c
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   110
    | cs => const "_sort" $ classes cs)
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   111
  end;
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   112
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   113
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   114
(* term_of_typ *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   115
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   116
fun term_of_typ show_sorts ty =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   117
  let
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   118
    fun of_sort t S =
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   119
      if show_sorts then const "_ofsort" $ t $ term_of_sort S
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   120
      else t;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   121
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   122
    fun term_of (Type (a, tys)) = list_comb (const a, map term_of tys)
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   123
      | term_of (TFree (x, S)) = of_sort (free x) S	(* FIXME mark? *)
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   124
      | term_of (TVar (xi, S)) = of_sort (var xi) S;	(* FIXME mark? *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
  in
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   126
    term_of ty
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   127
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   129
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
(** the type syntax **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   132
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   133
(* parse ast translations *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
347
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   135
fun tapp_ast_tr (*"_tapp"*) [ty, f] = Appl [f, ty]
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   136
  | tapp_ast_tr (*"_tapp"*) asts = raise_ast "tapp_ast_tr" asts;
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   137
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   138
fun tappl_ast_tr (*"_tappl"*) [ty, tys, f] =
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   139
      Appl (f :: ty :: unfold_ast "_types" tys)
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   140
  | tappl_ast_tr (*"_tappl"*) asts = raise_ast "tappl_ast_tr" asts;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   141
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   142
fun bracket_ast_tr (*"_bracket"*) [dom, cod] =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   143
      fold_ast_p "fun" (unfold_ast "_types" dom, cod)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   144
  | bracket_ast_tr (*"_bracket"*) asts = raise_ast "bracket_ast_tr" asts;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   145
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   146
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   147
(* print ast translations *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   148
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   149
fun tappl_ast_tr' (f, []) = raise_ast "tappl_ast_tr'" [f]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   150
  | tappl_ast_tr' (f, [ty]) = Appl [Constant "_tapp", ty, f]
347
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   151
  | tappl_ast_tr' (f, ty :: tys) =
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   152
      Appl [Constant "_tappl", ty, fold_ast "_types" tys, f];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   153
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   154
fun fun_ast_tr' (*"fun"*) asts =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   155
  (case unfold_ast_p "fun" (Appl (Constant "fun" :: asts)) of
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   156
    (dom as _ :: _ :: _, cod)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   157
      => Appl [Constant "_bracket", fold_ast "_types" dom, cod]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   158
  | _ => raise Match);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   159
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   161
(* type_ext *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   162
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   163
val sortT = Type ("sort", []);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   164
val classesT = Type ("classes", []);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   165
val typesT = Type ("types", []);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   166
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 640
diff changeset
   167
val type_ext = mk_syn_ext false []
347
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   168
  [Mfix ("_",           tidT --> typeT,                "", [], max_pri),
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   169
   Mfix ("_",           tvarT --> typeT,               "", [], max_pri),
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   170
   Mfix ("_",           idT --> typeT,                 "", [], max_pri),
330
2fda15dd1e0f changed the way a grammar is generated to allow the new parser to work;
clasohm
parents: 258
diff changeset
   171
   Mfix ("_::_",        [tidT, sortT] ---> typeT,      "_ofsort", [max_pri, 0], max_pri),
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   172
   Mfix ("_::_",        [tvarT, sortT] ---> typeT,     "_ofsort", [max_pri, 0], max_pri),
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   173
   Mfix ("_",           idT --> sortT,                 "", [], max_pri),
2584
b386951e15e6 improved comments;
wenzelm
parents: 2438
diff changeset
   174
   Mfix ("{}",          sortT,                         "_topsort", [], max_pri),
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   175
   Mfix ("{_}",         classesT --> sortT,            "_sort", [], max_pri),
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   176
   Mfix ("_",           idT --> classesT,              "", [], max_pri),
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   177
   Mfix ("_,_",         [idT, classesT] ---> classesT, "_classes", [], max_pri),
330
2fda15dd1e0f changed the way a grammar is generated to allow the new parser to work;
clasohm
parents: 258
diff changeset
   178
   Mfix ("_ _",         [typeT, idT] ---> typeT,       "_tapp", [max_pri, 0], max_pri),
2fda15dd1e0f changed the way a grammar is generated to allow the new parser to work;
clasohm
parents: 258
diff changeset
   179
   Mfix ("((1'(_,/ _'))_)", [typeT, typesT, idT] ---> typeT, "_tappl", [], max_pri),
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   180
   Mfix ("_",           typeT --> typesT,              "", [], max_pri),
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   181
   Mfix ("_,/ _",       [typeT, typesT] ---> typesT,   "_types", [], max_pri),
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   182
   Mfix ("(_/ => _)",   [typeT, typeT] ---> typeT,     "fun", [1, 0], 0),
624
33b9b5da3e6f made major changes to grammar;
clasohm
parents: 557
diff changeset
   183
   Mfix ("([_]/ => _)", [typesT, typeT] ---> typeT,    "_bracket", [0, 0], 0),
2678
d5fe793293ac added "_" syntax for dummyT;
wenzelm
parents: 2584
diff changeset
   184
   Mfix ("'(_')",       typeT --> typeT,               "", [0], max_pri),
d5fe793293ac added "_" syntax for dummyT;
wenzelm
parents: 2584
diff changeset
   185
   Mfix ("'_",          typeT,                         "dummy", [], max_pri)]
258
e540b7d4ecb1 minor internal changes;
wenzelm
parents: 239
diff changeset
   186
  []
347
cd41a57221d0 changed translation of type applications according to new grammar;
wenzelm
parents: 330
diff changeset
   187
  ([("_tapp", tapp_ast_tr), ("_tappl", tappl_ast_tr), ("_bracket", bracket_ast_tr)],
239
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   188
   [],
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   189
   [],
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   190
   [("fun", fun_ast_tr')])
08b6e842ec16 minor internal changes;
wenzelm
parents: 18
diff changeset
   191
  ([], []);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   192
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   193
end;