From ffe6097c534c82b9402bb6f0a57abeebd075e61d Mon Sep 17 00:00:00 2001
From: Eugen Wissner <belka@caraus.de>
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}
 <type> = <array-type>
 	\alt{} <pointer-type>
@@ -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}
-<procedure-heading> = `proc' <identifier-definition> \\
-	`(' [<field> \{`,' <field>\}] `)' <return-declaration>.
+<identifiers> = <identifier> \{`,' <identifier>\}.
+
+<parameter> = <identifiers> `:\@' <type>.
+
+<procedure-heading> = `(' [<parameter> \{`;' <parameter>\}] `)' <return-declaration>.
 
-<block> = <constant-part> <variable-part> <statement-part> `end'.
+<procedure-body> = <constant-part> <variable-part> <statement-part> `end'.
 
-<procedure-declaration> = <procedure-heading> `;' (block | `extern').
+<procedure-declaration> = `proc' <identifier-definition> <procedure-heading> \\
+	(<procedure-body> | `extern').
 
-<return-declaration> = [`->' `!\@' | `->' type].
+<return-declaration> = [`:\@' `!\@' | `:\@' type].
 
-<procedure-type> = `proc' `(' [<types>] `)' <return-declaration>.
+<procedure-type> = `proc' <procedure-heading>.
 \end{grammar}
 
 \begin{lstlisting}[caption=Example]
-program;
 var
   a: proc(Int) -> Int;
 
@@ -84,13 +91,12 @@ end.
 \chapter{Records}
 
 \begin{grammar}
-<field> = <identifier> `:\@' <type>.
+<field> = <identifiers> `:\@' <type>.
 
 <record-type> = `record' [`(' <identifier> `)'] [<field> \{`;' <field>\}] `end'.
 \end{grammar}
 
 \begin{lstlisting}[caption=Example]
-program;
 type
   T = record
     x: Int
@@ -111,11 +117,10 @@ end.
 \chapter{Enumerations}
 
 \begin{grammar}
-<enumeration-type> = `(' <identifier> \{`,' <identifier>\} `)'.
+<enumeration-type> = `(' <identifiers> `)'.
 \end{grammar}
 
 \begin{lstlisting}[caption=Example]
-program;
 type
   E = (one, two, three);
 var
-- 
cgit v1.2.3

