doc-src/Codegen/Thy/Introduction.thy
author haftmann
Fri, 13 Aug 2010 14:40:15 +0200
changeset 38405 7935b334893e
parent 38402 58fc3a3af71f
child 38437 ffb1c5bf0425
permissions -rw-r--r--
sketch of new outline
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28213
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
     1
theory Introduction
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
     2
imports Setup
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
     3
begin
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
     4
38405
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
     5
section {* Introduction *}
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
     6
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
     7
subsection {* Code generation fundamental: shallow embedding *}
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
     8
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
     9
subsection {* A quick start with the @{text "Isabelle/HOL"} toolbox *}
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
    10
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
    11
subsection {* Type classes *}
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
    12
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
    13
subsection {* How to continue from here *}
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
    14
7935b334893e sketch of new outline
haftmann
parents: 38402
diff changeset
    15
subsection {* If something goes utterly wrong *}
28213
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
    16
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
    17
text {*
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
    18
  This tutorial introduces a generic code generator for the
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    19
  @{text Isabelle} system.
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    20
  The
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    21
  \qn{target language} for which code is
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    22
  generated is not fixed, but may be one of several
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    23
  functional programming languages (currently, the implementation
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    24
  supports @{text SML} \cite{SML}, @{text OCaml} \cite{OCaml} and @{text Haskell}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    25
  \cite{haskell-revised-report}).
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    26
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    27
  Conceptually the code generator framework is part
28428
haftmann
parents: 28420
diff changeset
    28
  of Isabelle's @{theory Pure} meta logic framework; the logic
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    29
  @{theory HOL} \cite{isa-tutorial}, which is an extension of @{theory Pure},
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    30
  already comes with a reasonable framework setup and thus provides
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    31
  a good basis for creating code-generation-driven
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    32
  applications.  So, we assume some familiarity and experience
28428
haftmann
parents: 28420
diff changeset
    33
  with the ingredients of the @{theory HOL} distribution theories.
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    34
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    35
  The code generator aims to be usable with no further ado
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    36
  in most cases, while allowing for detailed customisation.
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    37
  This can be seen in the structure of this tutorial: after a short
28447
haftmann
parents: 28428
diff changeset
    38
  conceptual introduction with an example (\secref{sec:intro}),
haftmann
parents: 28428
diff changeset
    39
  we discuss the generic customisation facilities (\secref{sec:program}).
31050
555b56b66fcf adaptation replaces adaption
haftmann
parents: 30882
diff changeset
    40
  A further section (\secref{sec:adaptation}) is dedicated to the matter of
555b56b66fcf adaptation replaces adaption
haftmann
parents: 30882
diff changeset
    41
  \qn{adaptation} to specific target language environments.  After some
28447
haftmann
parents: 28428
diff changeset
    42
  further issues (\secref{sec:further}) we conclude with an overview
haftmann
parents: 28428
diff changeset
    43
  of some ML programming interfaces (\secref{sec:ml}).
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    44
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    45
  \begin{warn}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    46
    Ultimately, the code generator which this tutorial deals with
28447
haftmann
parents: 28428
diff changeset
    47
    is supposed to replace the existing code generator
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    48
    by Stefan Berghofer \cite{Berghofer-Nipkow:2002}.
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    49
    So, for the moment, there are two distinct code generators
28447
haftmann
parents: 28428
diff changeset
    50
    in Isabelle.  In case of ambiguity, we will refer to the framework
haftmann
parents: 28428
diff changeset
    51
    described here as @{text "generic code generator"}, to the
haftmann
parents: 28428
diff changeset
    52
    other as @{text "SML code generator"}.
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    53
    Also note that while the framework itself is
28428
haftmann
parents: 28420
diff changeset
    54
    object-logic independent, only @{theory HOL} provides a reasonable
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    55
    framework setup.    
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    56
  \end{warn}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    57
28213
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
    58
*}
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
    59
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    60
subsection {* Code generation via shallow embedding \label{sec:intro} *}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    61
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    62
text {*
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    63
  The key concept for understanding @{text Isabelle}'s code generation is
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    64
  \emph{shallow embedding}, i.e.~logical entities like constants, types and
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    65
  classes are identified with corresponding concepts in the target language.
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    66
28428
haftmann
parents: 28420
diff changeset
    67
  Inside @{theory HOL}, the @{command datatype} and
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    68
  @{command definition}/@{command primrec}/@{command fun} declarations form
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    69
  the core of a functional programming language.  The default code generator setup
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
    70
   transforms those into functional programs immediately.
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    71
  This means that \qt{naive} code generation can proceed without further ado.
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    72
  For example, here a simple \qt{implementation} of amortised queues:
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    73
*}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    74
29798
6df726203e39 proper datatype abstraction example
haftmann
parents: 29560
diff changeset
    75
datatype %quote 'a queue = AQueue "'a list" "'a list"
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    76
28564
haftmann
parents: 28447
diff changeset
    77
definition %quote empty :: "'a queue" where
29798
6df726203e39 proper datatype abstraction example
haftmann
parents: 29560
diff changeset
    78
  "empty = AQueue [] []"
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    79
28564
haftmann
parents: 28447
diff changeset
    80
primrec %quote enqueue :: "'a \<Rightarrow> 'a queue \<Rightarrow> 'a queue" where
29798
6df726203e39 proper datatype abstraction example
haftmann
parents: 29560
diff changeset
    81
  "enqueue x (AQueue xs ys) = AQueue (x # xs) ys"
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    82
28564
haftmann
parents: 28447
diff changeset
    83
fun %quote dequeue :: "'a queue \<Rightarrow> 'a option \<times> 'a queue" where
29798
6df726203e39 proper datatype abstraction example
haftmann
parents: 29560
diff changeset
    84
    "dequeue (AQueue [] []) = (None, AQueue [] [])"
6df726203e39 proper datatype abstraction example
haftmann
parents: 29560
diff changeset
    85
  | "dequeue (AQueue xs (y # ys)) = (Some y, AQueue xs ys)"
6df726203e39 proper datatype abstraction example
haftmann
parents: 29560
diff changeset
    86
  | "dequeue (AQueue xs []) =
6df726203e39 proper datatype abstraction example
haftmann
parents: 29560
diff changeset
    87
      (case rev xs of y # ys \<Rightarrow> (Some y, AQueue [] ys))"
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    88
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    89
text {* \noindent Then we can generate code e.g.~for @{text SML} as follows: *}
28213
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
    90
28564
haftmann
parents: 28447
diff changeset
    91
export_code %quote empty dequeue enqueue in SML
28447
haftmann
parents: 28428
diff changeset
    92
  module_name Example file "examples/example.ML"
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    93
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    94
text {* \noindent resulting in the following code: *}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    95
28564
haftmann
parents: 28447
diff changeset
    96
text %quote {*@{code_stmts empty enqueue dequeue (SML)}*}
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    97
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    98
text {*
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
    99
  \noindent The @{command export_code} command takes a space-separated list of
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   100
  constants for which code shall be generated;  anything else needed for those
28447
haftmann
parents: 28428
diff changeset
   101
  is added implicitly.  Then follows a target language identifier
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   102
  (@{text SML}, @{text OCaml} or @{text Haskell}) and a freely chosen module name.
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   103
  A file name denotes the destination to store the generated code.  Note that
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   104
  the semantics of the destination depends on the target language:  for
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   105
  @{text SML} and @{text OCaml} it denotes a \emph{file}, for @{text Haskell}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   106
  it denotes a \emph{directory} where a file named as the module name
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   107
  (with extension @{text ".hs"}) is written:
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   108
*}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   109
28564
haftmann
parents: 28447
diff changeset
   110
export_code %quote empty dequeue enqueue in Haskell
28447
haftmann
parents: 28428
diff changeset
   111
  module_name Example file "examples/"
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   112
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   113
text {*
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   114
  \noindent This is the corresponding code in @{text Haskell}:
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   115
*}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   116
28564
haftmann
parents: 28447
diff changeset
   117
text %quote {*@{code_stmts empty enqueue dequeue (Haskell)}*}
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   118
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   119
text {*
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   120
  \noindent This demonstrates the basic usage of the @{command export_code} command;
28447
haftmann
parents: 28428
diff changeset
   121
  for more details see \secref{sec:further}.
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   122
*}
28213
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
   123
38402
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   124
subsection {* If something utterly fails *}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   125
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   126
text {*
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   127
  Under certain circumstances, the code generator fails to produce
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   128
  code entirely.  
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   129
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   130
  \begin{description}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   131
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   132
    \ditem{generate only one module}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   133
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   134
    \ditem{check with a different target language}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   135
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   136
    \ditem{inspect code equations}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   137
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   138
    \ditem{inspect preprocessor setup}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   139
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   140
    \ditem{generate exceptions}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   141
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   142
    \ditem{remove offending code equations}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   143
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   144
  \end{description}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   145
*}
58fc3a3af71f added stub "If something utterly fails"
haftmann
parents: 34155
diff changeset
   146
28447
haftmann
parents: 28428
diff changeset
   147
subsection {* Code generator architecture \label{sec:concept} *}
28213
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
   148
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   149
text {*
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   150
  What you have seen so far should be already enough in a lot of cases.  If you
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   151
  are content with this, you can quit reading here.  Anyway, in order to customise
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   152
  and adapt the code generator, it is necessary to gain some understanding
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   153
  how it works.
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   154
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   155
  \begin{figure}[h]
30882
d15725e84091 moved generated eps/pdf to main directory, for proper display in dvi;
wenzelm
parents: 30880
diff changeset
   156
    \includegraphics{architecture}
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   157
    \caption{Code generator architecture}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   158
    \label{fig:arch}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   159
  \end{figure}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   160
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   161
  The code generator employs a notion of executability
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   162
  for three foundational executable ingredients known
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   163
  from functional programming:
29560
fa6c5d62adf5 "code equation" replaces "defining equation"
haftmann
parents: 28635
diff changeset
   164
  \emph{code equations}, \emph{datatypes}, and
fa6c5d62adf5 "code equation" replaces "defining equation"
haftmann
parents: 28635
diff changeset
   165
  \emph{type classes}.  A code equation as a first approximation
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   166
  is a theorem of the form @{text "f t\<^isub>1 t\<^isub>2 \<dots> t\<^isub>n \<equiv> t"}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   167
  (an equation headed by a constant @{text f} with arguments
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   168
  @{text "t\<^isub>1 t\<^isub>2 \<dots> t\<^isub>n"} and right hand side @{text t}).
29560
fa6c5d62adf5 "code equation" replaces "defining equation"
haftmann
parents: 28635
diff changeset
   169
  Code generation aims to turn code equations
28447
haftmann
parents: 28428
diff changeset
   170
  into a functional program.  This is achieved by three major
haftmann
parents: 28428
diff changeset
   171
  components which operate sequentially, i.e. the result of one is
haftmann
parents: 28428
diff changeset
   172
  the input
30880
257cbe43faa8 tuned manual
haftmann
parents: 30836
diff changeset
   173
  of the next in the chain,  see figure \ref{fig:arch}:
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   174
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   175
  \begin{itemize}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   176
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   177
    \item The starting point is a collection of raw code equations in a
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   178
      theory. It is not relevant where they
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   179
      stem from, but typically they were either produced by specification
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   180
      tools or proved explicitly by the user.
30836
1344132160bb proper external tikz pictures
haftmann
parents: 30227
diff changeset
   181
      
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   182
    \item These raw code equations can be subjected to theorem transformations.  This
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   183
      \qn{preprocessor} can apply the full
30836
1344132160bb proper external tikz pictures
haftmann
parents: 30227
diff changeset
   184
      expressiveness of ML-based theorem transformations to code
34155
14aaccb399b3 Polishing up the English
paulson
parents: 31050
diff changeset
   185
      generation.  The result of preprocessing is a
30836
1344132160bb proper external tikz pictures
haftmann
parents: 30227
diff changeset
   186
      structured collection of code equations.
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   187
30836
1344132160bb proper external tikz pictures
haftmann
parents: 30227
diff changeset
   188
    \item These code equations are \qn{translated} to a program in an
1344132160bb proper external tikz pictures
haftmann
parents: 30227
diff changeset
   189
      abstract intermediate language.  Think of it as a kind
28447
haftmann
parents: 28428
diff changeset
   190
      of \qt{Mini-Haskell} with four \qn{statements}: @{text data}
29560
fa6c5d62adf5 "code equation" replaces "defining equation"
haftmann
parents: 28635
diff changeset
   191
      (for datatypes), @{text fun} (stemming from code equations),
28447
haftmann
parents: 28428
diff changeset
   192
      also @{text class} and @{text inst} (for type classes).
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   193
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   194
    \item Finally, the abstract program is \qn{serialised} into concrete
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   195
      source code of a target language.
30836
1344132160bb proper external tikz pictures
haftmann
parents: 30227
diff changeset
   196
      This step only produces concrete syntax but does not change the
1344132160bb proper external tikz pictures
haftmann
parents: 30227
diff changeset
   197
      program in essence; all conceptual transformations occur in the
1344132160bb proper external tikz pictures
haftmann
parents: 30227
diff changeset
   198
      translation step.
28419
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   199
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   200
  \end{itemize}
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   201
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   202
  \noindent From these steps, only the two last are carried out outside the logic;  by
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   203
  keeping this layer as thin as possible, the amount of code to trust is
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   204
  kept to a minimum.
f65e8b318581 re-canibalised manual
haftmann
parents: 28213
diff changeset
   205
*}
28213
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
   206
b52f9205a02d New outline for codegen tutorial -- draft
haftmann
parents:
diff changeset
   207
end