src/Pure/Syntax/mixfix.ML
author wenzelm
Sun, 11 Feb 2001 20:38:40 +0100
changeset 11098 a3299b153741
parent 9734 3a9f1931b30c
child 11651 201b3f76c7b7
permissions -rw-r--r--
added "xsymbols" syntax for "=?=";
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/Syntax/mixfix.ML
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
551
4c139c37dbaf minor cleanings;
wenzelm
parents: 472
diff changeset
     3
    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
     4
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
     5
Mixfix declarations, infixes, binders. Also parts of the Pure syntax.
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
     6
*)
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
     7
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
     8
signature MIXFIX0 =
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
     9
sig
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    10
  datatype mixfix =
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    11
    NoSyn |
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    12
    Mixfix of string * int list * int |
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    13
    Delimfix of string |
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    14
    InfixlName of string * int |
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    15
    InfixrName of string * int |
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    16
    Infixl of int |
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    17
    Infixr of int |
865
b38c67991122 added optional precedence for body of binder;
clasohm
parents: 842
diff changeset
    18
    Binder of string * int * int
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    19
end;
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    20
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    21
signature MIXFIX1 =
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    22
sig
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    23
  include MIXFIX0
4823
588538fb9308 added no_syn;
wenzelm
parents: 4697
diff changeset
    24
  val no_syn: 'a * 'b -> 'a * 'b * mixfix
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    25
  val type_name: string -> mixfix -> string
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    26
  val const_name: string -> mixfix -> string
5056
e88cc76cb052 added fix_mixfix;
wenzelm
parents: 4920
diff changeset
    27
  val fix_mixfix: string -> mixfix -> mixfix
4823
588538fb9308 added no_syn;
wenzelm
parents: 4697
diff changeset
    28
  val mixfix_args: mixfix -> int
4920
9c4ff93762a0 pure_nonterms;
wenzelm
parents: 4823
diff changeset
    29
  val pure_nonterms: string list
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    30
  val pure_syntax: (string * string * mixfix) list
1181
c4e90fb7f8fa moved mixfix syntax from sign.ML
clasohm
parents: 1178
diff changeset
    31
  val pure_appl_syntax: (string * string * mixfix) list
c4e90fb7f8fa moved mixfix syntax from sign.ML
clasohm
parents: 1178
diff changeset
    32
  val pure_applC_syntax: (string * string * mixfix) list
6027
9dd06eeda95c added new print_mode "xsymbols" for extended symbol support
oheimb
parents: 5690
diff changeset
    33
  val pure_sym_syntax:  (string * string * mixfix) list
9dd06eeda95c added new print_mode "xsymbols" for extended symbol support
oheimb
parents: 5690
diff changeset
    34
  val pure_xsym_syntax: (string * string * mixfix) list
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    35
end;
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    36
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    37
signature MIXFIX =
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    38
sig
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    39
  include MIXFIX1
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    40
  val syn_ext_types: string list -> (string * int * mixfix) list
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    41
    -> SynExt.syn_ext
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    42
  val syn_ext_consts: string list -> (string * typ * mixfix) list
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    43
    -> SynExt.syn_ext
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    44
end;
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    45
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    46
1507
f600215b6ea7 Elimination of fully-functorial style.
paulson
parents: 1181
diff changeset
    47
structure Mixfix : MIXFIX =
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    48
struct
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    49
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    50
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    51
(** mixfix declarations **)
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    52
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    53
datatype mixfix =
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    54
  NoSyn |
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    55
  Mixfix of string * int list * int |
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    56
  Delimfix of string |
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    57
  InfixlName of string * int |
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    58
  InfixrName of string * int |
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    59
  Infixl of int |
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    60
  Infixr of int |
887
6a054d83acb2 *** empty log message ***
wenzelm
parents: 865
diff changeset
    61
  Binder of string * int * int;
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    62
4823
588538fb9308 added no_syn;
wenzelm
parents: 4697
diff changeset
    63
fun no_syn (x, y) = (x, y, NoSyn);
588538fb9308 added no_syn;
wenzelm
parents: 4697
diff changeset
    64
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    65
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    66
(* type / const names *)
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    67
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    68
fun strip ("'" :: c :: cs) = c :: strip cs
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    69
  | strip ["'"] = []
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    70
  | strip (c :: cs) = c :: strip cs
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    71
  | strip [] = [];
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    72
4697
101d384b69b2 Symbol.explode;
wenzelm
parents: 4143
diff changeset
    73
val strip_esc = implode o strip o Symbol.explode;
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    74
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    75
fun type_name t (InfixlName _) = t
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    76
  | type_name t (InfixrName _) = t
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    77
  | type_name t (Infixl _) = strip_esc t
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    78
  | type_name t (Infixr _) = strip_esc t
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    79
  | type_name t _ = t;
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    80
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    81
fun const_name c (InfixlName _) = c
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    82
  | const_name c (InfixrName _) = c
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    83
  | const_name c (Infixl _) = "op " ^ strip_esc c
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
    84
  | const_name c (Infixr _) = "op " ^ strip_esc c
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    85
  | const_name c _ = c;
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    86
5056
e88cc76cb052 added fix_mixfix;
wenzelm
parents: 4920
diff changeset
    87
fun fix_mixfix c (Infixl p) = (InfixlName (c, p))
e88cc76cb052 added fix_mixfix;
wenzelm
parents: 4920
diff changeset
    88
  | fix_mixfix c (Infixr p) = (InfixrName (c, p))
e88cc76cb052 added fix_mixfix;
wenzelm
parents: 4920
diff changeset
    89
  | fix_mixfix _ mx = mx;
e88cc76cb052 added fix_mixfix;
wenzelm
parents: 4920
diff changeset
    90
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
    91
4053
c88d0d5ae806 added mixfix_args;
wenzelm
parents: 3829
diff changeset
    92
(* mixfix_args *)
c88d0d5ae806 added mixfix_args;
wenzelm
parents: 3829
diff changeset
    93
c88d0d5ae806 added mixfix_args;
wenzelm
parents: 3829
diff changeset
    94
fun mixfix_args NoSyn = 0
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
    95
  | mixfix_args (Mixfix (sy, _, _)) = SynExt.mfix_args sy
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
    96
  | mixfix_args (Delimfix sy) = SynExt.mfix_args sy
4143
4bd5f4c05cf6 added TYPE syntax;
wenzelm
parents: 4053
diff changeset
    97
  | mixfix_args (*infix or binder*) _ = 2;
4053
c88d0d5ae806 added mixfix_args;
wenzelm
parents: 3829
diff changeset
    98
c88d0d5ae806 added mixfix_args;
wenzelm
parents: 3829
diff changeset
    99
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   100
(* syn_ext_types *)
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   101
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 639
diff changeset
   102
fun syn_ext_types logtypes type_decls =
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   103
  let
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   104
    fun name_of (t, _, mx) = type_name t mx;
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   105
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   106
    fun mk_infix sy t p1 p2 p3 =
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   107
      SynExt.Mfix ("(_ " ^ sy ^ "/ _)",
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   108
        [SynExt.typeT, SynExt.typeT] ---> SynExt.typeT, t, [p1, p2], p3);
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   109
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   110
    fun mfix_of decl =
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   111
      let val t = name_of decl in
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   112
        (case decl of
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   113
          (_, _, NoSyn) => None
6419
702527a8b2a1 fixed named type infixes (actual BUG!);
wenzelm
parents: 6027
diff changeset
   114
        | (_, 2, InfixlName (sy, p)) => Some (mk_infix sy t p (p + 1) p)
702527a8b2a1 fixed named type infixes (actual BUG!);
wenzelm
parents: 6027
diff changeset
   115
        | (_, 2, InfixrName (sy, p)) => Some (mk_infix sy t (p + 1) p p)
702527a8b2a1 fixed named type infixes (actual BUG!);
wenzelm
parents: 6027
diff changeset
   116
        | (sy, 2, Infixl p) => Some (mk_infix sy t p (p + 1) p)
702527a8b2a1 fixed named type infixes (actual BUG!);
wenzelm
parents: 6027
diff changeset
   117
        | (sy, 2, Infixr p) => Some (mk_infix sy t (p + 1) p p)
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   118
        | _ => error ("Bad mixfix declaration for type " ^ quote t))
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   119
      end;
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   120
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   121
    val mfix = mapfilter mfix_of type_decls;
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   122
    val xconsts = map name_of type_decls;
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   123
  in SynExt.syn_ext logtypes mfix xconsts ([], [], [], []) [] ([], []) end;
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   124
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   125
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   126
(* syn_ext_consts *)
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   127
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 639
diff changeset
   128
fun syn_ext_consts logtypes const_decls =
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   129
  let
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   130
    fun name_of (c, _, mx) = const_name c mx;
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   131
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   132
    fun mk_infix sy ty c p1 p2 p3 =
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   133
      [SynExt.Mfix ("op " ^ sy, ty, c, [], SynExt.max_pri),
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   134
       SynExt.Mfix ("(_ " ^ sy ^ "/ _)", ty, c, [p1, p2], p3)];
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   135
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   136
    fun binder_typ _ (Type ("fun", [Type ("fun", [_, ty2]), ty3])) =
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   137
          [Type ("idts", []), ty2] ---> ty3
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   138
      | binder_typ c _ = error ("Bad type of binder " ^ quote c);
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   139
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   140
    fun mfix_of decl =
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   141
      let val c = name_of decl in
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   142
        (case decl of
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   143
          (_, _, NoSyn) => []
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   144
        | (_, ty, Mixfix (sy, ps, p)) => [SynExt.Mfix (sy, ty, c, ps, p)]
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   145
        | (_, ty, Delimfix sy) => [SynExt.Mfix (sy, ty, c, [], SynExt.max_pri)]
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   146
        | (_, ty, InfixlName (sy, p)) => mk_infix sy ty c p (p + 1) p
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   147
        | (_, ty, InfixrName (sy, p)) => mk_infix sy ty c (p + 1) p p
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   148
        | (sy, ty, Infixl p) => mk_infix sy ty c p (p + 1) p
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   149
        | (sy, ty, Infixr p) => mk_infix sy ty c (p + 1) p p
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   150
        | (_, ty, Binder (sy, p, q)) =>
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   151
            [SynExt.Mfix ("(3" ^ sy ^ "_./ _)", binder_typ c ty, sy, [0, p], q)])
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   152
    end;
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   153
865
b38c67991122 added optional precedence for body of binder;
clasohm
parents: 842
diff changeset
   154
    fun binder (c, _, Binder (sy, _, _)) = Some (sy, c)
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   155
      | binder _ = None;
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   156
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   157
    val mfix = flat (map mfix_of const_decls);
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   158
    val xconsts = map name_of const_decls;
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   159
    val binders = mapfilter binder const_decls;
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   160
    val binder_trs = map SynTrans.mk_binder_tr binders;
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   161
    val binder_trs' = map (apsnd SynExt.fix_tr' o SynTrans.mk_binder_tr' o swap) binders;
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   162
  in SynExt.syn_ext logtypes mfix xconsts ([], binder_trs, binder_trs', []) [] ([], []) end;
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   163
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   164
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   165
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   166
(** Pure syntax **)
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   167
4920
9c4ff93762a0 pure_nonterms;
wenzelm
parents: 4823
diff changeset
   168
val pure_nonterms =
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   169
  (Lexicon.terminals @ [SynExt.logic, "type", "types", "sort", "classes",
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   170
    SynExt.args, SynExt.cargs, "pttrn", "pttrns", "idt", "idts", "aprop",
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   171
    "asms", SynExt.any, SynExt.sprop]);
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   172
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   173
val pure_syntax =
3690
3f7053bf4237 fixed idt/idts vs. pttrn/pttrns;
wenzelm
parents: 3027
diff changeset
   174
 [("_lambda",      "[pttrns, 'a] => logic",         Mixfix ("(3%_./ _)", [0, 3], 3)),
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   175
  ("_abs",         "'a",                            NoSyn),
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   176
  ("",             "'a => " ^ SynExt.args,          Delimfix "_"),
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   177
  ("_args",        "['a, " ^ SynExt.args ^ "] => " ^ SynExt.args, Delimfix "_,/ _"),
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   178
  ("",             "id => idt",                     Delimfix "_"),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   179
  ("_idtyp",       "[id, type] => idt",             Mixfix ("_::_", [], 0)),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   180
  ("",             "idt => idt",                    Delimfix "'(_')"),
3690
3f7053bf4237 fixed idt/idts vs. pttrn/pttrns;
wenzelm
parents: 3027
diff changeset
   181
  ("",             "idt => idts",                   Delimfix "_"),
3f7053bf4237 fixed idt/idts vs. pttrn/pttrns;
wenzelm
parents: 3027
diff changeset
   182
  ("_idts",        "[idt, idts] => idts",           Mixfix ("_/ _", [1, 0], 0)),
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   183
  ("",             "idt => pttrn",                  Delimfix "_"),
3690
3f7053bf4237 fixed idt/idts vs. pttrn/pttrns;
wenzelm
parents: 3027
diff changeset
   184
  ("",             "pttrn => pttrns",               Delimfix "_"),
3f7053bf4237 fixed idt/idts vs. pttrn/pttrns;
wenzelm
parents: 3027
diff changeset
   185
  ("_pttrns",      "[pttrn, pttrns] => pttrns",     Mixfix ("_/ _", [1, 0], 0)),
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   186
  ("",             "id => aprop",                   Delimfix "_"),
3829
d7333ef9e72c added longid syntax;
wenzelm
parents: 3815
diff changeset
   187
  ("",             "longid => aprop",               Delimfix "_"),
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   188
  ("",             "var => aprop",                  Delimfix "_"),
6929
16ee7b14a2c1 aprop: ??id, ...;
wenzelm
parents: 6759
diff changeset
   189
  ("_DDDOT",       "aprop",                         Delimfix "..."),
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   190
  ("_aprop",       "aprop => prop",                 Delimfix "PROP _"),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   191
  ("",             "prop => asms",                  Delimfix "_"),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   192
  ("_asms",        "[prop, asms] => asms",          Delimfix "_;/ _"),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   193
  ("_bigimpl",     "[asms, prop] => prop",          Mixfix ("((3[| _ |])/ ==> _)", [0, 1], 1)),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   194
  ("_ofclass",     "[type, logic] => prop",         Delimfix "(1OFCLASS/(1'(_,/ _')))"),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   195
  ("_mk_ofclass",  "_",                             NoSyn),
4143
4bd5f4c05cf6 added TYPE syntax;
wenzelm
parents: 4053
diff changeset
   196
  ("_TYPE",        "type => logic",                 Delimfix "(1TYPE/(1'(_')))"),
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   197
  ("_K",           "_",                             NoSyn),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   198
  ("",             "id => logic",                   Delimfix "_"),
3829
d7333ef9e72c added longid syntax;
wenzelm
parents: 3815
diff changeset
   199
  ("",             "longid => logic",               Delimfix "_"),
5287
0c055426fd6b ??id syntax for text variables;
wenzelm
parents: 5056
diff changeset
   200
  ("",             "var => logic",                  Delimfix "_"),
6759
8ce58492bf50 "..." syntax;
wenzelm
parents: 6419
diff changeset
   201
  ("_DDDOT",       "logic",                         Delimfix "...")];
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   202
1181
c4e90fb7f8fa moved mixfix syntax from sign.ML
clasohm
parents: 1178
diff changeset
   203
val pure_appl_syntax =
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   204
 [("_appl", "[('b => 'a), args] => logic", Mixfix ("(1_/(1'(_')))", [SynExt.max_pri, 0], SynExt.max_pri)),
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   205
  ("_appl", "[('b => 'a), args] => aprop", Mixfix ("(1_/(1'(_')))", [SynExt.max_pri, 0], SynExt.max_pri))];
1181
c4e90fb7f8fa moved mixfix syntax from sign.ML
clasohm
parents: 1178
diff changeset
   206
c4e90fb7f8fa moved mixfix syntax from sign.ML
clasohm
parents: 1178
diff changeset
   207
val pure_applC_syntax =
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   208
 [("",       "'a => cargs",                  Delimfix "_"),
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   209
  ("_cargs", "['a, cargs] => cargs",         Mixfix ("_/ _", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri)),
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   210
  ("_applC", "[('b => 'a), cargs] => logic", Mixfix ("(1_/ _)", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri - 1)),
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   211
  ("_applC", "[('b => 'a), cargs] => aprop", Mixfix ("(1_/ _)", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri - 1))];
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   212
2256
e9326ab92fbc symbol name changes;
wenzelm
parents: 2199
diff changeset
   213
val pure_sym_syntax =
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   214
 [("fun",      "[type, type] => type",  Mixfix ("(_/ \\<Rightarrow> _)", [1, 0], 0)),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   215
  ("_bracket", "[types, type] => type", Mixfix ("([_]/ \\<Rightarrow> _)", [0, 0], 0)),
5690
4b056ee5435c no open;
wenzelm
parents: 5287
diff changeset
   216
  ("_ofsort",  "[tid, sort] => type",   Mixfix ("_\\<Colon>_", [SynExt.max_pri, 0], SynExt.max_pri)),
2767
e1d15eabb64d added \<Colon> syntax for constraints (more compact!);
wenzelm
parents: 2696
diff changeset
   217
  ("_constrain", "['a, type] => 'a",    Mixfix ("_\\<Colon>_", [4, 0], 3)),
e1d15eabb64d added \<Colon> syntax for constraints (more compact!);
wenzelm
parents: 2696
diff changeset
   218
  ("_idtyp",   "[id, type] => idt",     Mixfix ("_\\<Colon>_", [], 0)),
3690
3f7053bf4237 fixed idt/idts vs. pttrn/pttrns;
wenzelm
parents: 3027
diff changeset
   219
  ("_lambda",  "[pttrns, 'a] => logic", Mixfix ("(3\\<lambda>_./ _)", [0, 3], 3)),
2696
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   220
  ("==>",      "[prop, prop] => prop",  InfixrName ("\\<Midarrow>\\<Rightarrow>", 1)),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   221
  ("_bigimpl", "[asms, prop] => prop",  Mixfix ("((3\\<lbrakk>_\\<rbrakk>)/ \\<Midarrow>\\<Rightarrow> _)", [0, 1], 1)),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   222
  ("==",       "['a::{}, 'a] => prop",  InfixrName ("\\<equiv>", 2)),
a41b9ee247ec added _mk_ofclass(S);
wenzelm
parents: 2677
diff changeset
   223
  ("!!",       "[idts, prop] => prop",  Mixfix ("(3\\<And>_./ _)", [0, 0], 0))];
2199
bcb360f80dac added Infixl/rName: specify infix name independently from syntax;
wenzelm
parents: 1952
diff changeset
   224
6027
9dd06eeda95c added new print_mode "xsymbols" for extended symbol support
oheimb
parents: 5690
diff changeset
   225
val pure_xsym_syntax =
9dd06eeda95c added new print_mode "xsymbols" for extended symbol support
oheimb
parents: 5690
diff changeset
   226
 [("==>",      "[prop, prop] => prop",  InfixrName ("\\<Longrightarrow>", 1)),
11098
a3299b153741 added "xsymbols" syntax for "=?=";
wenzelm
parents: 9734
diff changeset
   227
  ("=?=",      "['a::{}, 'a] => prop",  InfixrName ("\\<equiv>\\<^sup>?", 2)),
9734
3a9f1931b30c added \<dots> syntax;
wenzelm
parents: 7471
diff changeset
   228
  ("_DDDOT",   "aprop",                 Delimfix "\\<dots>"),
3a9f1931b30c added \<dots> syntax;
wenzelm
parents: 7471
diff changeset
   229
  ("_bigimpl", "[asms, prop] => prop",  Mixfix ("((3\\<lbrakk>_\\<rbrakk>)/ \\<Longrightarrow> _)", [0, 1], 1)),
3a9f1931b30c added \<dots> syntax;
wenzelm
parents: 7471
diff changeset
   230
  ("_DDDOT",   "logic",                 Delimfix "\\<dots>")];
3829
d7333ef9e72c added longid syntax;
wenzelm
parents: 3815
diff changeset
   231
384
a8d204d8071d support for new style mixfix annotations;
wenzelm
parents:
diff changeset
   232
end;