
\chapter{The compiler}

\class{program} \label{cl:program}

\begin{description}
  The program class is both used for the representation of
  non compiled and of compiled programs.
  Moreover, pointers to the corresponding source are provided.

  Internally, a program looks much like a lisp-program;
  a program is either an uncompiled string atom,
  a compiled instance atom, or an array of programs.
  Furthermore, the program representation contains two fields
  pointing to the start end end locations of the corresponding source code.

  The ¤type¤ class is a synonym for the ¤program¤ class.
  Types are never compiled, whence always considered syntactically.
\end{description}

\begin{class-fields}
  \item[int status]
    Either ¤UNCOMPILED¤, ¤COMPILED¤ or ¤COMPOSITE¤.
  \item[string s]
    If ¤status¤=¤UNCOMPILED¤, the program is a string ¤s¤.
  \item[instance ins]
    If ¤status¤=¤COMPILED¤, the program is an instance ¤ins¤.
    The ¤instance¤ class is described below \ref{cl:instance}.
  \item[array<program> a]
    If ¤status¤=¤COMPOSITE¤, the program is an array of programs.
    As in Lisp, the first array element corresponds to a function,
    the other elements correspond to the arguments.
  \item[location start, end]
    Start end end locations of the program in the original source program.
    ¤location¤ is a synonym for ¤int¤.
    The location ¤-1¤ corresponds to an unknown location in the source.
\end{class-fields}

\class{instance} \label{cl:instance}

\begin{description}
  An instance corresponds to a compiled atom,
  either a constant or an identifier.
  The instance representation is abstract.
  Concrete instance representation classes are
  ¤system_instance_rep¤, ¤integer_instance_rep¤, ¤string_instance_rep¤,
  ¤varaible_instance_rep¤ and ¤lambda_instance_rep¤.
\end{description}

\begin{class-fields}
  \item[string name]
    The name of the instance.
  \item[type t]
    The type of the instance.
\end{class-fields}
