124 fun mixfix_args NoSyn = 0 |
123 fun mixfix_args NoSyn = 0 |
125 | mixfix_args (Mixfix (sy, _, _)) = SynExt.mfix_args sy |
124 | mixfix_args (Mixfix (sy, _, _)) = SynExt.mfix_args sy |
126 | mixfix_args (Delimfix sy) = SynExt.mfix_args sy |
125 | mixfix_args (Delimfix sy) = SynExt.mfix_args sy |
127 | mixfix_args (*infix or binder*) _ = 2; |
126 | mixfix_args (*infix or binder*) _ = 2; |
128 |
127 |
|
128 fun maxpris sy = replicate (SynExt.mfix_args sy) 0; |
|
129 |
129 |
130 |
130 (* syn_ext_types *) |
131 (* syn_ext_types *) |
131 |
132 |
132 fun syn_ext_types logtypes type_decls = |
133 fun syn_ext_types logtypes type_decls = |
133 let |
134 let |
134 fun name_of (t, _, mx) = type_name t mx; |
135 fun name_of (t, _, mx) = type_name t mx; |
135 |
136 |
136 fun mk_infix sy t p1 p2 p3 = |
137 fun mk_infix sy t p1 p2 p3 = |
137 SynExt.Mfix ("(_ " ^ sy ^ "/ _)", |
138 SynExt.Mfix ("(_ " ^ sy ^ "/ _)", |
138 [SynExt.typeT, SynExt.typeT] ---> SynExt.typeT, t, [p1, p2], p3); |
139 [SynExt.typeT, SynExt.typeT] ---> SynExt.typeT, t, p1 :: maxpris sy @ [p2], p3); |
139 |
140 |
140 fun mfix_of decl = |
141 fun mfix_of decl = |
141 let val t = name_of decl in |
142 let val t = name_of decl in |
142 (case decl of |
143 (case decl of |
143 (_, _, NoSyn) => None |
144 (_, _, NoSyn) => None |
161 let |
162 let |
162 fun name_of (c, _, mx) = const_name c mx; |
163 fun name_of (c, _, mx) = const_name c mx; |
163 |
164 |
164 fun mk_infix sy ty c p1 p2 p3 = |
165 fun mk_infix sy ty c p1 p2 p3 = |
165 [SynExt.Mfix ("op " ^ sy, ty, c, [], SynExt.max_pri), |
166 [SynExt.Mfix ("op " ^ sy, ty, c, [], SynExt.max_pri), |
166 SynExt.Mfix ("(_ " ^ sy ^ "/ _)", ty, c, [p1, p2], p3)]; |
167 SynExt.Mfix ("(_ " ^ sy ^ "/ _)", ty, c, p1 :: maxpris sy @ [p2], p3)]; |
167 |
168 |
168 fun binder_typ _ (Type ("fun", [Type ("fun", [_, ty2]), ty3])) = |
169 fun binder_typ _ (Type ("fun", [Type ("fun", [_, ty2]), ty3])) = |
169 [Type ("idts", []), ty2] ---> ty3 |
170 [Type ("idts", []), ty2] ---> ty3 |
170 | binder_typ c _ = error ("Bad type of binder " ^ quote c); |
171 | binder_typ c _ = error ("Bad type of binder " ^ quote c); |
171 |
172 |
233 ("", "longid => logic", Delimfix "_"), |
234 ("", "longid => logic", Delimfix "_"), |
234 ("", "var => logic", Delimfix "_"), |
235 ("", "var => logic", Delimfix "_"), |
235 ("_DDDOT", "logic", Delimfix "..."), |
236 ("_DDDOT", "logic", Delimfix "..."), |
236 ("_constify", "num => num_const", Delimfix "_"), |
237 ("_constify", "num => num_const", Delimfix "_"), |
237 ("_index", "num_const => index", Delimfix "\\<^sub>_"), |
238 ("_index", "num_const => index", Delimfix "\\<^sub>_"), |
|
239 ("_indexvar", "index", Delimfix "\\<index>"), |
238 ("_noindex", "index", Delimfix ""), |
240 ("_noindex", "index", Delimfix ""), |
239 ("_struct", "index => logic", Delimfix "\\<struct>_")]; |
241 ("_struct", "index => logic", Delimfix "\\<struct>_")]; |
240 |
242 |
241 val pure_appl_syntax = |
243 val pure_appl_syntax = |
242 [("_appl", "[('b => 'a), args] => logic", Mixfix ("(1_/(1'(_')))", [SynExt.max_pri, 0], SynExt.max_pri)), |
244 [("_appl", "[('b => 'a), args] => logic", Mixfix ("(1_/(1'(_')))", [SynExt.max_pri, 0], SynExt.max_pri)), |
246 [("", "'a => cargs", Delimfix "_"), |
248 [("", "'a => cargs", Delimfix "_"), |
247 ("_cargs", "['a, cargs] => cargs", Mixfix ("_/ _", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri)), |
249 ("_cargs", "['a, cargs] => cargs", Mixfix ("_/ _", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri)), |
248 ("_applC", "[('b => 'a), cargs] => logic", Mixfix ("(1_/ _)", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri - 1)), |
250 ("_applC", "[('b => 'a), cargs] => logic", Mixfix ("(1_/ _)", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri - 1)), |
249 ("_applC", "[('b => 'a), cargs] => aprop", Mixfix ("(1_/ _)", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri - 1))]; |
251 ("_applC", "[('b => 'a), cargs] => aprop", Mixfix ("(1_/ _)", [SynExt.max_pri, SynExt.max_pri], SynExt.max_pri - 1))]; |
250 |
252 |
251 val pure_sym_syntax = |
253 val pure_xsym_syntax = |
252 [("fun", "[type, type] => type", Mixfix ("(_/ \\<Rightarrow> _)", [1, 0], 0)), |
254 [("fun", "[type, type] => type", Mixfix ("(_/ \\<Rightarrow> _)", [1, 0], 0)), |
253 ("_bracket", "[types, type] => type", Mixfix ("([_]/ \\<Rightarrow> _)", [0, 0], 0)), |
255 ("_bracket", "[types, type] => type", Mixfix ("([_]/ \\<Rightarrow> _)", [0, 0], 0)), |
254 ("_ofsort", "[tid, sort] => type", Mixfix ("_\\<Colon>_", [SynExt.max_pri, 0], SynExt.max_pri)), |
256 ("_ofsort", "[tid, sort] => type", Mixfix ("_\\<Colon>_", [SynExt.max_pri, 0], SynExt.max_pri)), |
255 ("_constrain", "['a, type] => 'a", Mixfix ("_\\<Colon>_", [4, 0], 3)), |
257 ("_constrain", "['a, type] => 'a", Mixfix ("_\\<Colon>_", [4, 0], 3)), |
256 ("_idtyp", "[id, type] => idt", Mixfix ("_\\<Colon>_", [], 0)), |
258 ("_idtyp", "[id, type] => idt", Mixfix ("_\\<Colon>_", [], 0)), |
257 ("_lambda", "[pttrns, 'a] => logic", Mixfix ("(3\\<lambda>_./ _)", [0, 3], 3)), |
259 ("_lambda", "[pttrns, 'a] => logic", Mixfix ("(3\\<lambda>_./ _)", [0, 3], 3)), |
258 ("==>", "[prop, prop] => prop", InfixrName ("\\<Midarrow>\\<Rightarrow>", 1)), |
|
259 ("_bigimpl", "[asms, prop] => prop", Mixfix ("((3\\<lbrakk>_\\<rbrakk>)/ \\<Midarrow>\\<Rightarrow> _)", [0, 1], 1)), |
|
260 ("==", "['a::{}, 'a] => prop", InfixrName ("\\<equiv>", 2)), |
260 ("==", "['a::{}, 'a] => prop", InfixrName ("\\<equiv>", 2)), |
261 ("!!", "[idts, prop] => prop", Mixfix ("(3\\<And>_./ _)", [0, 0], 0))]; |
261 ("!!", "[idts, prop] => prop", Mixfix ("(3\\<And>_./ _)", [0, 0], 0)), |
262 |
262 ("==>", "[prop, prop] => prop", InfixrName ("\\<Longrightarrow>", 1)), |
263 val pure_xsym_syntax = |
|
264 [("==>", "[prop, prop] => prop", InfixrName ("\\<Longrightarrow>", 1)), |
|
265 ("=?=", "['a::{}, 'a] => prop", InfixrName ("\\<equiv>\\<^sup>?", 2)), |
263 ("=?=", "['a::{}, 'a] => prop", InfixrName ("\\<equiv>\\<^sup>?", 2)), |
266 ("_DDDOT", "aprop", Delimfix "\\<dots>"), |
264 ("_DDDOT", "aprop", Delimfix "\\<dots>"), |
267 ("_bigimpl", "[asms, prop] => prop", Mixfix ("((3\\<lbrakk>_\\<rbrakk>)/ \\<Longrightarrow> _)", [0, 1], 1)), |
265 ("_bigimpl", "[asms, prop] => prop", Mixfix ("((3\\<lbrakk>_\\<rbrakk>)/ \\<Longrightarrow> _)", [0, 1], 1)), |
268 ("_DDDOT", "logic", Delimfix "\\<dots>")]; |
266 ("_DDDOT", "logic", Delimfix "\\<dots>")]; |
269 |
267 |