src/Doc/Codegen/Adaptation.thy
changeset 59482 9b590e32646a
parent 59379 c7f6f01ede15
child 60768 f47bd91fdc75
equal deleted inserted replaced
59481:74f638efffcb 59482:9b590e32646a
   146   \noindent As figure \ref{fig:adaptation} illustrates, all these
   146   \noindent As figure \ref{fig:adaptation} illustrates, all these
   147   adaptation mechanisms have to act consistently; it is at the
   147   adaptation mechanisms have to act consistently; it is at the
   148   discretion of the user to take care for this.
   148   discretion of the user to take care for this.
   149 \<close>
   149 \<close>
   150 
   150 
   151 subsection \<open>Common adaptation patterns\<close>
   151 subsection \<open>Common adaptation applications\<close>
   152 
   152 
   153 text \<open>
   153 text \<open>
   154   The @{theory HOL} @{theory Main} theory already provides a code
   154   The @{theory HOL} @{theory Main} theory already provides a code
   155   generator setup which should be suitable for most applications.
   155   generator setup which should be suitable for most applications.
   156   Common extensions and modifications are available by certain
   156   Common extensions and modifications are available by certain
   184 
   184 
   185     \item[@{text "Code_Target_Numeral"}] is a convenience theory
   185     \item[@{text "Code_Target_Numeral"}] is a convenience theory
   186        containing both @{text "Code_Target_Nat"} and
   186        containing both @{text "Code_Target_Nat"} and
   187        @{text "Code_Target_Int"}.
   187        @{text "Code_Target_Int"}.
   188 
   188 
   189     \item[@{text "Code_Char"}] represents @{text HOL} characters by
       
   190        character literals in target languages.
       
   191 
       
   192     \item[@{theory "String"}] provides an additional datatype @{typ
   189     \item[@{theory "String"}] provides an additional datatype @{typ
   193        String.literal} which is isomorphic to strings; @{typ
   190        String.literal} which is isomorphic to strings; @{typ
   194        String.literal}s are mapped to target-language strings.  Useful
   191        String.literal}s are mapped to target-language strings.  Useful
   195        for code setups which involve e.g.~printing (error) messages.
   192        for code setups which involve e.g.~printing (error) messages.
   196        Part of @{text "HOL-Main"}.
   193        Part of @{text "HOL-Main"}.
       
   194 
       
   195     \item[@{text "Code_Char"}] represents @{text HOL} characters by
       
   196        character literals in target languages.  \emph{Warning:} This
       
   197        modifies adaptation in a non-conservative manner and thus
       
   198        should always be imported \emph{last} in a theory header.
   197 
   199 
   198     \item[@{theory "IArray"}] provides a type @{typ "'a iarray"}
   200     \item[@{theory "IArray"}] provides a type @{typ "'a iarray"}
   199        isomorphic to lists but implemented by (effectively immutable)
   201        isomorphic to lists but implemented by (effectively immutable)
   200        arrays \emph{in SML only}.
   202        arrays \emph{in SML only}.
   201 
   203