From ffe6097c534c82b9402bb6f0a57abeebd075e61d Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 8 Jul 2026 11:04:34 +0200 Subject: Allow multiple fields with the same type --- doc/type-system.tex | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'doc/type-system.tex') diff --git a/doc/type-system.tex b/doc/type-system.tex index 3ae8a30..e1497be 100644 --- a/doc/type-system.tex +++ b/doc/type-system.tex @@ -1,5 +1,11 @@ \part{Type system} +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. + \begin{grammar} = \alt{} @@ -27,7 +33,6 @@ \end{grammar} \begin{lstlisting}[caption=Example] -program; var x: Int; y: ^Int; @@ -44,7 +49,6 @@ end. \end{grammar} \begin{lstlisting}[caption=Example] -program; var array: [3]Int := [1, 2, 3]; begin @@ -55,20 +59,23 @@ end. \chapter{Procedure types} \begin{grammar} - = `proc' \\ - `(' [ \{`,' \}] `)' . + = \{`,' \}. + + = `:\@' . + + = `(' [ \{`;' \}] `)' . - = `end'. + = `end'. - = `;' (block | `extern'). + = `proc' \\ + ( | `extern'). - = [`->' `!\@' | `->' type]. + = [`:\@' `!\@' | `:\@' type]. - = `proc' `(' [] `)' . + = `proc' . \end{grammar} \begin{lstlisting}[caption=Example] -program; var a: proc(Int) -> Int; @@ -84,13 +91,12 @@ end. \chapter{Records} \begin{grammar} - = `:\@' . + = `:\@' . = `record' [`(' `)'] [ \{`;' \}] `end'. \end{grammar} \begin{lstlisting}[caption=Example] -program; type T = record x: Int @@ -111,11 +117,10 @@ end. \chapter{Enumerations} \begin{grammar} - = `(' \{`,' \} `)'. + = `(' `)'. \end{grammar} \begin{lstlisting}[caption=Example] -program; type E = (one, two, three); var -- cgit v1.2.3