53 \item Subtle errors can be introduced unconsciously. |
53 \item Subtle errors can be introduced unconsciously. |
54 |
54 |
55 \end{itemize} |
55 \end{itemize} |
56 |
56 |
57 \noindent However, even if you ought refrain from setting up |
57 \noindent However, even if you ought refrain from setting up |
58 adaptation yourself, already the @{text "HOL"} comes with some |
58 adaptation yourself, already @{text "HOL"} comes with some |
59 reasonable default adaptations (say, using target language list |
59 reasonable default adaptations (say, using target language list |
60 syntax). There also some common adaptation cases which you can |
60 syntax). There also some common adaptation cases which you can |
61 setup by importing particular library theories. In order to |
61 setup by importing particular library theories. In order to |
62 understand these, we provide some clues here; these however are not |
62 understand these, we provide some clues here; these however are not |
63 supposed to replace a careful study of the sources. |
63 supposed to replace a careful study of the sources. |
144 |
144 |
145 \item[@{text "Code_Target_Nat"}] implements type @{typ int} |
145 \item[@{text "Code_Target_Nat"}] implements type @{typ int} |
146 by @{typ integer} and thus by target-language built-in integers; |
146 by @{typ integer} and thus by target-language built-in integers; |
147 contains @{text "Code_Binary_Nat"} as a prerequisite. |
147 contains @{text "Code_Binary_Nat"} as a prerequisite. |
148 |
148 |
149 \item[@{text "Code_Target_Numeral"}] is a convenience node |
149 \item[@{text "Code_Target_Numeral"}] is a convenience theory |
150 containing both @{text "Code_Target_Nat"} and |
150 containing both @{text "Code_Target_Nat"} and |
151 @{text "Code_Target_Int"}. |
151 @{text "Code_Target_Int"}. |
152 |
|
153 \item[@{text "Efficient_Nat"}] \label{eff_nat} implements |
|
154 natural numbers by integers, which in general will result in |
|
155 higher efficiency; pattern matching with @{term "0\<Colon>nat"} / |
|
156 @{const "Suc"} is eliminated; includes @{text "Code_Integer"} |
|
157 and @{text "Code_Numeral"}. |
|
158 |
152 |
159 \item[@{text "Code_Char"}] represents @{text HOL} characters by |
153 \item[@{text "Code_Char"}] represents @{text HOL} characters by |
160 character literals in target languages. |
154 character literals in target languages. |
161 |
155 |
162 \item[@{theory "String"}] provides an additional datatype @{typ |
156 \item[@{theory "String"}] provides an additional datatype @{typ |
163 String.literal} which is isomorphic to strings; @{typ |
157 String.literal} which is isomorphic to strings; @{typ |
164 String.literal}s are mapped to target-language strings. Useful |
158 String.literal}s are mapped to target-language strings. Useful |
165 for code setups which involve e.g.~printing (error) messages. |
159 for code setups which involve e.g.~printing (error) messages. |
166 Part of @{text "HOL-Main"}. |
160 Part of @{text "HOL-Main"}. |
167 |
161 |
|
162 \item[@{theory "IArray"}] provides a type @{typ "'a iarray"} |
|
163 isomorphic to lists but implemented by (effectively immutable) |
|
164 arrays \emph{in SML only}. |
|
165 |
168 \end{description} |
166 \end{description} |
169 |
|
170 \begin{warn} |
|
171 When importing any of those theories which are not part of |
|
172 @{text "HOL-Main"}, they should form the last |
|
173 items in an import list. Since these theories adapt the code |
|
174 generator setup in a non-conservative fashion, strange effects may |
|
175 occur otherwise. |
|
176 \end{warn} |
|
177 *} |
167 *} |
178 |
168 |
179 |
169 |
180 subsection {* Parametrising serialisation \label{sec:adaptation_mechanisms} *} |
170 subsection {* Parametrising serialisation \label{sec:adaptation_mechanisms} *} |
181 |
171 |