src/Pure/Syntax/mixfix.ML
changeset 764 b60e77395d1a
parent 639 c88d56f7f33b
child 781 9ab8873bf9b3
equal deleted inserted replaced
763:d5a626aacdd3 764:b60e77395d1a
    76   | const_name c _ = c;
    76   | const_name c _ = c;
    77 
    77 
    78 
    78 
    79 (* syn_ext_types *)
    79 (* syn_ext_types *)
    80 
    80 
    81 fun syn_ext_types all_roots type_decls =
    81 fun syn_ext_types logtypes type_decls =
    82   let
    82   let
    83     fun name_of (t, _, mx) = type_name t mx;
    83     fun name_of (t, _, mx) = type_name t mx;
    84 
    84 
    85     fun mk_infix t p1 p2 p3 =
    85     fun mk_infix t p1 p2 p3 =
    86       Mfix ("(_ " ^ t ^ "/ _)", [typeT, typeT] ---> typeT,
    86       Mfix ("(_ " ^ t ^ "/ _)", [typeT, typeT] ---> typeT,
    93           quote (name_of decl));
    93           quote (name_of decl));
    94 
    94 
    95     val mfix = mapfilter mfix_of type_decls;
    95     val mfix = mapfilter mfix_of type_decls;
    96     val xconsts = map name_of type_decls;
    96     val xconsts = map name_of type_decls;
    97   in
    97   in
    98     syn_ext all_roots [] mfix xconsts ([], [], [], []) ([], [])
    98     syn_ext logtypes mfix xconsts ([], [], [], []) ([], [])
    99   end;
    99   end;
   100 
   100 
   101 
   101 
   102 (* syn_ext_consts *)
   102 (* syn_ext_consts *)
   103 
   103 
   104 fun syn_ext_consts all_roots const_decls =
   104 fun syn_ext_consts logtypes const_decls =
   105   let
   105   let
   106     fun name_of (c, _, mx) = const_name c mx;
   106     fun name_of (c, _, mx) = const_name c mx;
   107 
   107 
   108     fun mk_infix sy ty c p1 p2 p3 =
   108     fun mk_infix sy ty c p1 p2 p3 =
   109       [Mfix ("(_ " ^ sy ^ "/ _)", ty, c, [p1, p2], p3),
   109       [Mfix ("(_ " ^ sy ^ "/ _)", ty, c, [p1, p2], p3),
   128     val xconsts = map name_of const_decls;
   128     val xconsts = map name_of const_decls;
   129     val binders = mapfilter binder const_decls;
   129     val binders = mapfilter binder const_decls;
   130     val binder_trs = map mk_binder_tr binders;
   130     val binder_trs = map mk_binder_tr binders;
   131     val binder_trs' = map (mk_binder_tr' o swap) binders;
   131     val binder_trs' = map (mk_binder_tr' o swap) binders;
   132   in
   132   in
   133     syn_ext all_roots [] mfix xconsts ([], binder_trs, binder_trs', []) ([], [])
   133     syn_ext logtypes mfix xconsts ([], binder_trs, binder_trs', []) ([], [])
   134   end;
   134   end;
   135 
   135 
   136 
   136 
   137 
   137 
   138 (** Pure syntax **)
   138 (** Pure syntax **)
   139 
   139 
   140 val pure_types =
   140 val pure_types =
   141   map (fn t => (t, 0, NoSyn))
   141   map (fn t => (t, 0, NoSyn))
   142     (terminals @ [logic, "type", "types", "sort", "classes", args, "idt",
   142     (terminals @ [logic, "type", "types", "sort", "classes", args, "idt",
   143       "idts", "aprop", "asms", "any"]);
   143       "idts", "aprop", "asms"]);
   144 
   144 
   145 val pure_syntax =
   145 val pure_syntax =
   146  [("_lambda",   "[idts, 'a] => ('b => 'a)",       Mixfix ("(3%_./ _)", [], 0)),
   146  [("_lambda",   "[idts, 'a] => ('b => 'a)",       Mixfix ("(3%_./ _)", [], 0)),
   147   ("",          "'a => " ^ args,                  Delimfix "_"),
   147   ("",          "'a => " ^ args,                  Delimfix "_"),
   148   ("_args",     "['a, " ^ args ^ "] => " ^ args,  Delimfix "_,/ _"),
   148   ("_args",     "['a, " ^ args ^ "] => " ^ args,  Delimfix "_,/ _"),
   161   ("_bigimpl",  "[asms, prop] => prop",           Mixfix ("((3[| _ |]) ==>/ _)", [0, 1], 1)),
   161   ("_bigimpl",  "[asms, prop] => prop",           Mixfix ("((3[| _ |]) ==>/ _)", [0, 1], 1)),
   162   ("_ofclass",  "[type, 'a] => prop",             Delimfix "(1OFCLASS/(1'(_,/ _')))"),
   162   ("_ofclass",  "[type, 'a] => prop",             Delimfix "(1OFCLASS/(1'(_,/ _')))"),
   163   ("_K",        "'a",                             NoSyn),
   163   ("_K",        "'a",                             NoSyn),
   164   ("",          "id => logic",                    Delimfix "_"),
   164   ("",          "id => logic",                    Delimfix "_"),
   165   ("",          "var => logic",                   Delimfix "_"),
   165   ("",          "var => logic",                   Delimfix "_"),
   166   ("_appl",     "[logic, args] => logic",         Mixfix ("(1_/(1'(_')))", [max_pri, 0], max_pri)),
   166   ("_appl",     "[logic, args] => logic",         Mixfix ("(1_/(1'(_')))", [max_pri, 0], max_pri))]
   167   ("_constrain", "[logic, type] => logic",        Mixfix ("_::_", [4, 0], 3))]
       
   168 
   167 
   169 end;
   168 end;