1010 \indexdef{HOL}{command}{code\_instance}\hypertarget{command.HOL.code-instance}{\hyperlink{command.HOL.code-instance}{\mbox{\isa{\isacommand{code{\isacharunderscore}instance}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1010 \indexdef{HOL}{command}{code\_instance}\hypertarget{command.HOL.code-instance}{\hyperlink{command.HOL.code-instance}{\mbox{\isa{\isacommand{code{\isacharunderscore}instance}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1011 \indexdef{HOL}{command}{code\_reserved}\hypertarget{command.HOL.code-reserved}{\hyperlink{command.HOL.code-reserved}{\mbox{\isa{\isacommand{code{\isacharunderscore}reserved}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1011 \indexdef{HOL}{command}{code\_reserved}\hypertarget{command.HOL.code-reserved}{\hyperlink{command.HOL.code-reserved}{\mbox{\isa{\isacommand{code{\isacharunderscore}reserved}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1012 \indexdef{HOL}{command}{code\_monad}\hypertarget{command.HOL.code-monad}{\hyperlink{command.HOL.code-monad}{\mbox{\isa{\isacommand{code{\isacharunderscore}monad}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1012 \indexdef{HOL}{command}{code\_monad}\hypertarget{command.HOL.code-monad}{\hyperlink{command.HOL.code-monad}{\mbox{\isa{\isacommand{code{\isacharunderscore}monad}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1013 \indexdef{HOL}{command}{code\_include}\hypertarget{command.HOL.code-include}{\hyperlink{command.HOL.code-include}{\mbox{\isa{\isacommand{code{\isacharunderscore}include}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1013 \indexdef{HOL}{command}{code\_include}\hypertarget{command.HOL.code-include}{\hyperlink{command.HOL.code-include}{\mbox{\isa{\isacommand{code{\isacharunderscore}include}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1014 \indexdef{HOL}{command}{code\_modulename}\hypertarget{command.HOL.code-modulename}{\hyperlink{command.HOL.code-modulename}{\mbox{\isa{\isacommand{code{\isacharunderscore}modulename}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1014 \indexdef{HOL}{command}{code\_modulename}\hypertarget{command.HOL.code-modulename}{\hyperlink{command.HOL.code-modulename}{\mbox{\isa{\isacommand{code{\isacharunderscore}modulename}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
|
1015 \indexdef{HOL}{command}{code\_reflect}\hypertarget{command.HOL.code-reflect}{\hyperlink{command.HOL.code-reflect}{\mbox{\isa{\isacommand{code{\isacharunderscore}reflect}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} |
1015 \end{matharray} |
1016 \end{matharray} |
1016 |
1017 |
1017 \begin{rail} |
1018 \begin{rail} |
1018 'export\_code' ( constexpr + ) \\ |
1019 'export\_code' ( constexpr + ) \\ |
1019 ( ( 'in' target ( 'module\_name' string ) ? \\ |
1020 ( ( 'in' target ( 'module\_name' string ) ? \\ |
1082 ; |
1083 ; |
1083 |
1084 |
1084 'code\_modulename' target ( ( string string ) + ) |
1085 'code\_modulename' target ( ( string string ) + ) |
1085 ; |
1086 ; |
1086 |
1087 |
|
1088 'code\_reflect' string ( 'datatypes' ( string '=' ( string + '|' ) + 'and' ) ) ? \\ |
|
1089 ( 'functions' ( string + ) ) ? ( 'file' string ) ? |
|
1090 ; |
|
1091 |
1087 syntax: string | ( 'infix' | 'infixl' | 'infixr' ) nat string |
1092 syntax: string | ( 'infix' | 'infixl' | 'infixr' ) nat string |
1088 ; |
1093 ; |
1089 |
1094 |
1090 \end{rail} |
1095 \end{rail} |
1091 |
1096 |
1092 \begin{description} |
1097 \begin{description} |
1093 |
1098 |
1094 \item \hyperlink{command.HOL.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} generates code for a given list |
1099 \item \hyperlink{command.HOL.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} generates code for a given list |
1095 of constants in the specified target language(s). If no serialization |
1100 of constants in the specified target language(s). If no |
1096 instruction is given, only abstract code is generated internally. |
1101 serialization instruction is given, only abstract code is generated |
|
1102 internally. |
1097 |
1103 |
1098 Constants may be specified by giving them literally, referring to |
1104 Constants may be specified by giving them literally, referring to |
1099 all executable contants within a certain theory by giving \isa{{\isachardoublequote}name{\isachardot}{\isacharasterisk}{\isachardoublequote}}, or referring to \emph{all} executable constants currently |
1105 all executable contants within a certain theory by giving \isa{{\isachardoublequote}name{\isachardot}{\isacharasterisk}{\isachardoublequote}}, or referring to \emph{all} executable constants currently |
1100 available by giving \isa{{\isachardoublequote}{\isacharasterisk}{\isachardoublequote}}. |
1106 available by giving \isa{{\isachardoublequote}{\isacharasterisk}{\isachardoublequote}}. |
1101 |
1107 |
1102 By default, for each involved theory one corresponding name space |
1108 By default, for each involved theory one corresponding name space |
1103 module is generated. Alternativly, a module name may be specified |
1109 module is generated. Alternativly, a module name may be specified |
1104 after the \hyperlink{keyword.module-name}{\mbox{\isa{\isakeyword{module{\isacharunderscore}name}}}} keyword; then \emph{all} code is |
1110 after the \hyperlink{keyword.module-name}{\mbox{\isa{\isakeyword{module{\isacharunderscore}name}}}} keyword; then \emph{all} code is |
1105 placed in this module. |
1111 placed in this module. |
1106 |
1112 |
1107 For \emph{SML}, \emph{OCaml} and \emph{Scala} the file specification refers to a |
1113 For \emph{SML}, \emph{OCaml} and \emph{Scala} the file specification |
1108 single file; for \emph{Haskell}, it refers to a whole directory, |
1114 refers to a single file; for \emph{Haskell}, it refers to a whole |
1109 where code is generated in multiple files reflecting the module |
1115 directory, where code is generated in multiple files reflecting the |
1110 hierarchy. Omitting the file specification denotes standard |
1116 module hierarchy. Omitting the file specification denotes standard |
1111 output. |
1117 output. |
1112 |
1118 |
1113 Serializers take an optional list of arguments in parentheses. For |
1119 Serializers take an optional list of arguments in parentheses. For |
1114 \emph{SML} and \emph{OCaml}, ``\isa{no{\isacharunderscore}signatures}`` omits |
1120 \emph{SML} and \emph{OCaml}, ``\isa{no{\isacharunderscore}signatures}`` omits |
1115 explicit module signatures. |
1121 explicit module signatures. |
1116 |
1122 |
1117 For \emph{Haskell} a module name prefix may be given using the ``\isa{{\isachardoublequote}root{\isacharcolon}{\isachardoublequote}}'' argument; ``\isa{string{\isacharunderscore}classes}'' adds a ``\verb|deriving (Read, Show)|'' clause to each appropriate datatype |
1123 For \emph{Haskell} a module name prefix may be given using the |
1118 declaration. |
1124 ``\isa{{\isachardoublequote}root{\isacharcolon}{\isachardoublequote}}'' argument; ``\isa{string{\isacharunderscore}classes}'' adds a |
|
1125 ``\verb|deriving (Read, Show)|'' clause to each appropriate |
|
1126 datatype declaration. |
1119 |
1127 |
1120 \item \hyperlink{attribute.HOL.code}{\mbox{\isa{code}}} explicitly selects (or with option |
1128 \item \hyperlink{attribute.HOL.code}{\mbox{\isa{code}}} explicitly selects (or with option |
1121 ``\isa{{\isachardoublequote}del{\isachardoublequote}}'' deselects) a code equation for code generation. |
1129 ``\isa{{\isachardoublequote}del{\isachardoublequote}}'' deselects) a code equation for code generation. |
1122 Usually packages introducing code equations provide a reasonable |
1130 Usually packages introducing code equations provide a reasonable |
1123 default setup for selection. Variants \isa{{\isachardoublequote}code\ abstype{\isachardoublequote}} and |
1131 default setup for selection. Variants \isa{{\isachardoublequote}code\ abstype{\isachardoublequote}} and |
1124 \isa{{\isachardoublequote}code\ abstract{\isachardoublequote}} declare abstract datatype certificates or |
1132 \isa{{\isachardoublequote}code\ abstract{\isachardoublequote}} declare abstract datatype certificates or |
1125 code equations on abstract datatype representations respectively. |
1133 code equations on abstract datatype representations respectively. |
1126 |
1134 |
1127 \item \hyperlink{command.HOL.code-abort}{\mbox{\isa{\isacommand{code{\isacharunderscore}abort}}}} declares constants which are not |
1135 \item \hyperlink{command.HOL.code-abort}{\mbox{\isa{\isacommand{code{\isacharunderscore}abort}}}} declares constants which are not |
1128 required to have a definition by means of code equations; if |
1136 required to have a definition by means of code equations; if needed |
1129 needed these are implemented by program abort instead. |
1137 these are implemented by program abort instead. |
1130 |
1138 |
1131 \item \hyperlink{command.HOL.code-datatype}{\mbox{\isa{\isacommand{code{\isacharunderscore}datatype}}}} specifies a constructor set |
1139 \item \hyperlink{command.HOL.code-datatype}{\mbox{\isa{\isacommand{code{\isacharunderscore}datatype}}}} specifies a constructor set |
1132 for a logical type. |
1140 for a logical type. |
1133 |
1141 |
1134 \item \hyperlink{command.HOL.print-codesetup}{\mbox{\isa{\isacommand{print{\isacharunderscore}codesetup}}}} gives an overview on |
1142 \item \hyperlink{command.HOL.print-codesetup}{\mbox{\isa{\isacommand{print{\isacharunderscore}codesetup}}}} gives an overview on |
1135 selected code equations and code generator datatypes. |
1143 selected code equations and code generator datatypes. |
1136 |
1144 |
1137 \item \hyperlink{attribute.HOL.code-inline}{\mbox{\isa{code{\isacharunderscore}inline}}} declares (or with |
1145 \item \hyperlink{attribute.HOL.code-inline}{\mbox{\isa{code{\isacharunderscore}inline}}} declares (or with option |
1138 option ``\isa{{\isachardoublequote}del{\isachardoublequote}}'' removes) inlining theorems which are |
1146 ``\isa{{\isachardoublequote}del{\isachardoublequote}}'' removes) inlining theorems which are applied as |
1139 applied as rewrite rules to any code equation during |
1147 rewrite rules to any code equation during preprocessing. |
1140 preprocessing. |
1148 |
1141 |
1149 \item \hyperlink{attribute.HOL.code-post}{\mbox{\isa{code{\isacharunderscore}post}}} declares (or with option ``\isa{{\isachardoublequote}del{\isachardoublequote}}'' removes) theorems which are applied as rewrite rules to any |
1142 \item \hyperlink{attribute.HOL.code-post}{\mbox{\isa{code{\isacharunderscore}post}}} declares (or with |
1150 result of an evaluation. |
1143 option ``\isa{{\isachardoublequote}del{\isachardoublequote}}'' removes) theorems which are |
1151 |
1144 applied as rewrite rules to any result of an evaluation. |
1152 \item \hyperlink{command.HOL.print-codeproc}{\mbox{\isa{\isacommand{print{\isacharunderscore}codeproc}}}} prints the setup of the code |
1145 |
1153 generator preprocessor. |
1146 \item \hyperlink{command.HOL.print-codeproc}{\mbox{\isa{\isacommand{print{\isacharunderscore}codeproc}}}} prints the setup |
|
1147 of the code generator preprocessor. |
|
1148 |
1154 |
1149 \item \hyperlink{command.HOL.code-thms}{\mbox{\isa{\isacommand{code{\isacharunderscore}thms}}}} prints a list of theorems |
1155 \item \hyperlink{command.HOL.code-thms}{\mbox{\isa{\isacommand{code{\isacharunderscore}thms}}}} prints a list of theorems |
1150 representing the corresponding program containing all given |
1156 representing the corresponding program containing all given |
1151 constants after preprocessing. |
1157 constants after preprocessing. |
1152 |
1158 |
1184 will remove an already added ``include''. |
1190 will remove an already added ``include''. |
1185 |
1191 |
1186 \item \hyperlink{command.HOL.code-modulename}{\mbox{\isa{\isacommand{code{\isacharunderscore}modulename}}}} declares aliasings from one |
1192 \item \hyperlink{command.HOL.code-modulename}{\mbox{\isa{\isacommand{code{\isacharunderscore}modulename}}}} declares aliasings from one |
1187 module name onto another. |
1193 module name onto another. |
1188 |
1194 |
|
1195 \item \hyperlink{command.HOL.code-reflect}{\mbox{\isa{\isacommand{code{\isacharunderscore}reflect}}}} without a ``\isa{{\isachardoublequote}file{\isachardoublequote}}'' |
|
1196 argument compiles code into the system runtime environment and |
|
1197 modifies the code generator setup that future invocations of system |
|
1198 runtime code generation referring to one of the ``\isa{{\isachardoublequote}datatypes{\isachardoublequote}}'' or ``\isa{{\isachardoublequote}functions{\isachardoublequote}}'' entities use these precompiled |
|
1199 entities. With a ``\isa{{\isachardoublequote}file{\isachardoublequote}}'' argument, the corresponding code |
|
1200 is generated into that specified file without modifying the code |
|
1201 generator setup. |
|
1202 |
1189 \end{description} |
1203 \end{description} |
1190 |
1204 |
1191 The other framework generates code from both functional and relational |
1205 The other framework generates code from both functional and |
1192 programs to SML. See \cite{isabelle-HOL} for further information |
1206 relational programs to SML. See \cite{isabelle-HOL} for further |
1193 (this actually covers the new-style theory format as well). |
1207 information (this actually covers the new-style theory format as |
|
1208 well). |
1194 |
1209 |
1195 \begin{matharray}{rcl} |
1210 \begin{matharray}{rcl} |
1196 \indexdef{HOL}{command}{code\_module}\hypertarget{command.HOL.code-module}{\hyperlink{command.HOL.code-module}{\mbox{\isa{\isacommand{code{\isacharunderscore}module}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1211 \indexdef{HOL}{command}{code\_module}\hypertarget{command.HOL.code-module}{\hyperlink{command.HOL.code-module}{\mbox{\isa{\isacommand{code{\isacharunderscore}module}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1197 \indexdef{HOL}{command}{code\_library}\hypertarget{command.HOL.code-library}{\hyperlink{command.HOL.code-library}{\mbox{\isa{\isacommand{code{\isacharunderscore}library}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1212 \indexdef{HOL}{command}{code\_library}\hypertarget{command.HOL.code-library}{\hyperlink{command.HOL.code-library}{\mbox{\isa{\isacommand{code{\isacharunderscore}library}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1198 \indexdef{HOL}{command}{consts\_code}\hypertarget{command.HOL.consts-code}{\hyperlink{command.HOL.consts-code}{\mbox{\isa{\isacommand{consts{\isacharunderscore}code}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
1213 \indexdef{HOL}{command}{consts\_code}\hypertarget{command.HOL.consts-code}{\hyperlink{command.HOL.consts-code}{\mbox{\isa{\isacommand{consts{\isacharunderscore}code}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |