equal
deleted
inserted
replaced
152 (syn_decls curried sign tl) |
152 (syn_decls curried sign tl) |
153 | syn_decls curried sign (_::tl) = syn_decls curried sign tl |
153 | syn_decls curried sign (_::tl) = syn_decls curried sign tl |
154 | syn_decls _ _ [] = []; |
154 | syn_decls _ _ [] = []; |
155 |
155 |
156 fun translate name vars rhs = |
156 fun translate name vars rhs = |
157 Syntax.<-> ((Ast.mk_appl (Constant (mk_internal_name name)) |
157 Syntax.ParsePrintRule ((Ast.mk_appl (Constant (mk_internal_name name)) |
158 (map Variable vars)), |
158 (map Variable vars)), |
159 rhs); |
159 rhs); |
160 |
160 |
161 (* generating the translation rules. Called by add_ext_axioms(_i) *) |
161 (* generating the translation rules. Called by add_ext_axioms(_i) *) |
162 local open Ast in |
162 local open Ast in |
176 | xrules_of true ((name,typ,CMixfix(_))::tail) = |
176 | xrules_of true ((name,typ,CMixfix(_))::tail) = |
177 let fun argnames n (Type("->" ,[_,t]))= chr n :: argnames (n+1) t |
177 let fun argnames n (Type("->" ,[_,t]))= chr n :: argnames (n+1) t |
178 | argnames _ _ = []; |
178 | argnames _ _ = []; |
179 val names = argnames (ord"A") typ; |
179 val names = argnames (ord"A") typ; |
180 in if names = [] then [] else |
180 in if names = [] then [] else |
181 [Syntax.<-> (mk_appl (Constant name) (map Variable names), |
181 [Syntax.ParsePrintRule (mk_appl (Constant name) (map Variable names), |
182 foldl (fn (t,arg) => |
182 foldl (fn (t,arg) => |
183 (mk_appl (Constant "@fapp") [t,Variable arg])) |
183 (mk_appl (Constant "@fapp") [t,Variable arg])) |
184 (Constant name,names))] |
184 (Constant name,names))] |
185 end |
185 end |
186 @xrules_of true tail |
186 @xrules_of true tail |
205 fun argnames n (Type("*" ,[_,t]))= chr n :: argnames (n+1) t |
205 fun argnames n (Type("*" ,[_,t]))= chr n :: argnames (n+1) t |
206 | argnames n _ = [chr n]; |
206 | argnames n _ = [chr n]; |
207 val vars = map Variable (case typ of (Type("->" ,[t,_])) =>argnames (ord"A") t |
207 val vars = map Variable (case typ of (Type("->" ,[t,_])) =>argnames (ord"A") t |
208 | _ => []); |
208 | _ => []); |
209 in if vars = [] then [] else |
209 in if vars = [] then [] else |
210 [Syntax.<-> |
210 [Syntax.ParsePrintRule |
211 (mk_appl (Constant name) vars, |
211 (mk_appl (Constant name) vars, |
212 mk_appl (Constant "@fapp") |
212 mk_appl (Constant "@fapp") |
213 [Constant name, |
213 [Constant name, |
214 case vars of [v] => v |
214 case vars of [v] => v |
215 | args => mk_appl (Constant "@ctuple") |
215 | args => mk_appl (Constant "@ctuple") |