\part{Language}

An Elna program consists of one or more source files, called \textbf{modules}.

Each module can declare \textbf{types}, \textbf{global variables} and
\textbf{procedures}, used by this module or exported to be used by other
modules.

Each procedure can get some input and produce an output as a result of
executing a \textbf{statement block}, a list, where each \textbf{statement}
is executed in the order it appears in the block.

Statement components are other statement blocks and \textbf{expressions},
where a statement has control over the evaluation of its components.
Statements can also modify the state of the procedure or the program by
mutating variables.

Most simple expressions are identifiers referencing program's symbols and
literals. These atomic expressions can be combined to more complex expressions
by applying various operations to one or more expressions.

\chapter{Expressions}

The expression \verb|@r.field| includes 3 expressions:

\begin{enumerate}
	\item Variable expression \verb|r|.
	\item Field access \verb|(r).field|.
	\item Address taking \verb|@(r.field)|.
\end{enumerate}

The expression is evaluated in the above order. The postfix expressions
like field access have higher precedence than prefix operators.

\section{Binary expressions}

\begin{table}
\centering
\begin{tabularx}{0.8\textwidth}{%
	l
	>{\centering\arraybackslash}X
	>{\raggedright\arraybackslash}X
}
	\textbf{Precedence} & \textbf{Operator} & \textbf{Description}\\
	\toprule
	1 & $* \quad / \quad \%$ & Multiplication, division and remainder.\\
	\midrule
	2 & $+ \quad -$ & Addition and subtraction.\\
	\midrule
	3 & $<< \quad >>$ & Left and right shifts.\\
	\midrule
	4 & $= \quad <> \quad > \quad < \quad <= \quad >=$ & Relational operators.\\
	\midrule
	5 & $or \quad xor \quad \&$ & Logical operators.\\
	\bottomrule
\end{tabularx}
\caption{Operator precedence}
\end{table}

\section{Unary expressions}

Unary expressions are expressions with a prefix operator followed by one
operand.

\verb|@| (\textit{at sign}) takes the address of its operand. The operand expression should be
addressable.

\verb|-| (\textit{minus}) negates a numeric value.

\verb|~| (\textit{tilde}) applied on a boolean acts as logical not. Applied on a numeric – as
bitwise not.

\chapter{Conditional statements}
\chapter{Loop statements}
