src/Tools/Code/code_preproc.ML
changeset 31998 2c7a24f74db9
parent 31977 e03059ae2d82
child 32072 d4bff63bcbf1
equal deleted inserted replaced
31997:de0d280c31a7 31998:2c7a24f74db9
   524 (** setup **)
   524 (** setup **)
   525 
   525 
   526 val setup = 
   526 val setup = 
   527   let
   527   let
   528     fun mk_attribute f = Thm.declaration_attribute (fn thm => Context.mapping (f thm) I);
   528     fun mk_attribute f = Thm.declaration_attribute (fn thm => Context.mapping (f thm) I);
   529     fun add_del_attribute (name, (add, del)) =
   529     fun add_del_attribute_parser (add, del) =
   530       Code.add_attribute (name, Args.del |-- Scan.succeed (mk_attribute del)
   530       Attrib.add_del (mk_attribute add) (mk_attribute del);
   531         || Scan.succeed (mk_attribute add))
   531   in
   532   in
   532     Attrib.setup @{binding code_inline} (add_del_attribute_parser (add_inline, del_inline))
   533     add_del_attribute ("inline", (add_inline, del_inline))
   533         "preprocessing equations for code generator"
   534     #> add_del_attribute ("post", (add_post, del_post))
   534     #> Attrib.setup @{binding code_post} (add_del_attribute_parser (add_post, del_post))
   535     #> Code.add_attribute ("unfold", Scan.succeed (Thm.declaration_attribute
   535         "postprocessing equations for code generator"
   536        (fn thm => Context.mapping (Codegen.add_unfold thm #> add_inline thm) I)))
   536     #> Attrib.setup @{binding code_unfold} (Scan.succeed (mk_attribute
       
   537        (fn thm => Codegen.add_unfold thm #> add_inline thm)))
       
   538         "preprocessing equations for code generators"
   537   end;
   539   end;
   538 
   540 
   539 val _ =
   541 val _ =
   540   OuterSyntax.improper_command "print_codeproc" "print code preprocessor setup"
   542   OuterSyntax.improper_command "print_codeproc" "print code preprocessor setup"
   541   OuterKeyword.diag (Scan.succeed
   543   OuterKeyword.diag (Scan.succeed