doc-src/IsarAdvanced/Codegen/Thy/Further.thy
changeset 28419 f65e8b318581
parent 28213 b52f9205a02d
child 28447 df77ed974a78
equal deleted inserted replaced
28418:4ffb62675ade 28419:f65e8b318581
     1 theory Further
     1 theory Further
     2 imports Setup
     2 imports Setup
     3 begin
     3 begin
     4 
     4 
     5 section {* Further topics *}
     5 section {* Further topics \label{sec:further} *}
     6 
     6 
     7 subsection {* Serializer options *}
     7 subsection {* Further reading *}
       
     8 
       
     9 text {*
       
    10   Do dive deeper into the issue of code generation, you should visit
       
    11   the Isabelle/Isar Reference Manual \cite{isabelle-isar-ref} which
       
    12   constains exhaustive syntax diagrams.
       
    13 *}
       
    14 
       
    15 subsection {* Modules *}
       
    16 
       
    17 text {*
       
    18   When invoking the @{command export_code} command it is possible to leave
       
    19   out the @{keyword "module_name"} part;  then code is distributed over
       
    20   different modules, where the module name space roughly is induced
       
    21   by the @{text Isabelle} theory namespace.
       
    22 
       
    23   Then sometimes the awkward situation occurs that dependencies between
       
    24   definitions introduce cyclic dependencies between modules, which in the
       
    25   @{text Haskell} world leaves you to the mercy of the @{text Haskell} implementation
       
    26   you are using,  while for @{text SML}/@{text OCaml} code generation is not possible.
       
    27 
       
    28   A solution is to declare module names explicitly.
       
    29   Let use assume the three cyclically dependent
       
    30   modules are named \emph{A}, \emph{B} and \emph{C}.
       
    31   Then, by stating
       
    32 *}
       
    33 
       
    34 code_modulename SML
       
    35   A ABC
       
    36   B ABC
       
    37   C ABC
       
    38 
       
    39 text {*
       
    40   we explicitly map all those modules on \emph{ABC},
       
    41   resulting in an ad-hoc merge of this three modules
       
    42   at serialisation time.
       
    43 *}
     8 
    44 
     9 subsection {* Evaluation oracle *}
    45 subsection {* Evaluation oracle *}
    10 
    46 
    11 subsection {* Code antiquotation *}
    47 subsection {* Code antiquotation *}
    12 
    48 
    13 subsection {* Creating new targets *}
    49 subsection {* Creating new targets *}
    14 
    50 
    15 text {* extending targets, adding targets *}
    51 text {* extending targets, adding targets *}
    16 
    52 
       
    53 subsection {* Imperative data structures *}
       
    54 
    17 end
    55 end