explicit namings for generated code
authorhaftmann
Fri, 24 Oct 2008 10:41:13 +0200
changeset 28679d7384e8e99b3
parent 28678 d93980a6c3cb
child 28680 f1c76cf10915
explicit namings for generated code
doc-src/IsarAdvanced/Codegen/Thy/Adaption.thy
doc-src/IsarAdvanced/Codegen/Thy/document/Adaption.tex
doc-src/more_antiquote.ML
     1.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/Adaption.thy	Thu Oct 23 16:07:03 2008 +0200
     1.2 +++ b/doc-src/IsarAdvanced/Codegen/Thy/Adaption.thy	Fri Oct 24 10:41:13 2008 +0200
     1.3 @@ -2,7 +2,7 @@
     1.4  imports Setup
     1.5  begin
     1.6  
     1.7 -setup %invisible {* Code_Target.extend_target ("\<SML>", ("SML", I)) *}
     1.8 +setup %invisible {* Code_Target.extend_target ("\<SML>", ("SML", K I)) *}
     1.9  
    1.10  section {* Adaption to target languages \label{sec:adaption} *}
    1.11  
     2.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/document/Adaption.tex	Thu Oct 23 16:07:03 2008 +0200
     2.2 +++ b/doc-src/IsarAdvanced/Codegen/Thy/document/Adaption.tex	Fri Oct 24 10:41:13 2008 +0200
     2.3 @@ -26,7 +26,7 @@
     2.4  %
     2.5  \isataginvisible
     2.6  \isacommand{setup}\isamarkupfalse%
     2.7 -\ {\isacharverbatimopen}\ Code{\isacharunderscore}Target{\isachardot}extend{\isacharunderscore}target\ {\isacharparenleft}{\isachardoublequote}{\isasymSML}{\isachardoublequote}{\isacharcomma}\ {\isacharparenleft}{\isachardoublequote}SML{\isachardoublequote}{\isacharcomma}\ I{\isacharparenright}{\isacharparenright}\ {\isacharverbatimclose}%
     2.8 +\ {\isacharverbatimopen}\ Code{\isacharunderscore}Target{\isachardot}extend{\isacharunderscore}target\ {\isacharparenleft}{\isachardoublequote}{\isasymSML}{\isachardoublequote}{\isacharcomma}\ {\isacharparenleft}{\isachardoublequote}SML{\isachardoublequote}{\isacharcomma}\ K\ I{\isacharparenright}{\isacharparenright}\ {\isacharverbatimclose}%
     2.9  \endisataginvisible
    2.10  {\isafoldinvisible}%
    2.11  %
     3.1 --- a/doc-src/more_antiquote.ML	Thu Oct 23 16:07:03 2008 +0200
     3.2 +++ b/doc-src/more_antiquote.ML	Fri Oct 24 10:41:13 2008 +0200
     3.3 @@ -56,19 +56,19 @@
     3.4    val parse_const_terms = Scan.repeat1 Args.term
     3.5      >> (fn ts => fn thy => map (Code_Unit.check_const thy) ts);
     3.6    val parse_consts = Scan.lift (Args.parens (Args.$$$ "consts")) |-- parse_const_terms
     3.7 -    >> (fn mk_cs => fn thy => map (Code_Name.const thy) (mk_cs thy));
     3.8 +    >> (fn mk_cs => fn thy => fn naming => map (the o Code_Thingol.lookup_const naming) (mk_cs thy));
     3.9    val parse_types = Scan.lift (Args.parens (Args.$$$ "types") |-- Scan.repeat1 Args.name)
    3.10 -    >> (fn tycos => fn thy => map (Code_Name.tyco thy o Sign.intern_type thy) tycos);
    3.11 +    >> (fn tycos => fn thy => fn naming => map (the o Code_Thingol.lookup_tyco naming o Sign.intern_type thy) tycos);
    3.12    val parse_classes = Scan.lift (Args.parens (Args.$$$ "classes") |-- Scan.repeat1 Args.name)
    3.13 -    >> (fn classes => fn thy => map (Code_Name.class thy o Sign.intern_class thy) classes);
    3.14 +    >> (fn classes => fn thy => fn naming => map (the o Code_Thingol.lookup_class naming o Sign.intern_class thy) classes);
    3.15    val parse_instances = Scan.lift (Args.parens (Args.$$$ "instances") |-- Scan.repeat1 (Args.name --| Args.$$$ "::" -- Args.name))
    3.16 -    >> (fn insts => fn thy => map (Code_Name.instance thy o apsnd (Sign.intern_type thy) o apfst (Sign.intern_class thy) o swap) insts);
    3.17 +    >> (fn insts => fn thy => fn naming => map (the o Code_Thingol.lookup_instance naming o apsnd (Sign.intern_type thy) o apfst (Sign.intern_class thy) o swap) insts);
    3.18    val parse_names = parse_consts || parse_types || parse_classes || parse_instances; 
    3.19  
    3.20    fun code_stmts src ctxt ((mk_cs, mk_stmtss), target) =
    3.21      Code_Target.code_of (ProofContext.theory_of ctxt)
    3.22        target "Example" (mk_cs (ProofContext.theory_of ctxt))
    3.23 -        (maps (fn f => f (ProofContext.theory_of ctxt)) mk_stmtss)
    3.24 +        (fn naming => maps (fn f => f (ProofContext.theory_of ctxt) naming) mk_stmtss)
    3.25      |> split_lines
    3.26      |> verbatim_lines;
    3.27