2020-02-04 05:49:12 +03:00
|
|
|
\begin{figure}[t]
|
|
|
|
|
\[
|
|
|
|
|
\begin{array}{rcl}
|
|
|
|
|
\defterm{compilationUnit} & : & \nonterm{import}^\star\s\nonterm{scopeExpression}\\
|
|
|
|
|
\defterm{import} & : & \term{import}\s\token{UIDENT}\s\term{;}
|
|
|
|
|
\end{array}
|
|
|
|
|
\]
|
|
|
|
|
\caption{Compilation unit concrete syntax}
|
|
|
|
|
\label{compilation_unit}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
\section{Compilation Units}
|
2020-02-05 01:18:20 +03:00
|
|
|
\label{sec:compilation_units}
|
2020-02-04 05:49:12 +03:00
|
|
|
|
|
|
|
|
Compilation unit is a minimal structure recognized by a parser. An application can contain multiple units, compiled separatedly.
|
|
|
|
|
In order to use other units they have to be imported. In particular, the standard library is comprized of a number of precompiled units,
|
|
|
|
|
which can be imported by an end-user application.
|
|
|
|
|
|
2020-02-05 01:18:20 +03:00
|
|
|
The concrete syntax for compilation unit is shown on Fig.~\ref{compilation_unit}. Besides optional imports a unit must contain
|
2020-02-04 05:49:12 +03:00
|
|
|
a \nonterm{scopeExpression}, which may contain some definitions and computations. Note, a unit can not be empty. The computations described in
|
|
|
|
|
a unit are performed at unit initialization time (see~\ref{separate_compilation}).
|
|
|
|
|
|