From 265e6d6a27eebbcafbd73f0da76e516a139f21d1 Mon Sep 17 00:00:00 2001
From: Eugen Wissner <belka@caraus.de>
Date: Sat, 4 Jul 2026 22:29:49 +0200
Subject: Allow empty statements

---
 doc/appendix.tex | 46 +++++++++++++++++++++-------------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

(limited to 'doc/appendix.tex')

diff --git a/doc/appendix.tex b/doc/appendix.tex
index 09bdbde..d06a49b 100644
--- a/doc/appendix.tex
+++ b/doc/appendix.tex
@@ -64,7 +64,7 @@
 
 <selector> = `[' <expression> `]' | `.\@' <identifier> | `^'.
 
-<case> = <expressions> `:\@' <optional-statements>.
+<case> = <expressions> `:\@' <statements>.
 
 <designator> = <reference> <selector> | <identifier>.
 
@@ -95,9 +95,7 @@
 
 <types> = <type> \{`,' <type>\}.
 
-<required-statements> = <statement> \{`;' <statement>\}.
-
-<optional-statements> = [<required-statements>].
+<statements> = <statement> \{`;' <statement>\}.
 
 <return-declaration> = [`->' `!\@' | `->' type].
 
@@ -122,46 +120,46 @@
 
 <assignment> = <designator> `:=' <expression>.
 
-<if-statement> = `if' <expression> `then' <optional-statements> \\
-    \{`elsif' <expression> `then' <optional-statements>\} \\
-	{[`else' <optional-statements>]} `end'.
+<if-statement> = `if' <expression> `then' <statements> \\
+    \{`elsif' <expression> `then' <statements>\} \\
+	{[`else' <statements>]} `end'.
 
-<while-statement> = `while' <expression> `do' <optional-statements> \\
-    \{`elsif' <expression> `do' <optional-statements>\} `end'.
+<while-statement> = `while' <expression> `do' <statements> \\
+    \{`elsif' <expression> `do' <statements>\} `end'.
 
-<defer-statement> = `defer' <optional-statements> `end'.
+<defer-statement> = `defer' <statements> `end'.
 
 <case-statement> = `case' <expression> `of' <case> \{`|' case\} \\
-	{[`else' <optional-statements>]} `end'.
+	{[`else' <statements>]} `end'.
 
 <label-declaration> = `.\@' <identifier>.
 
 <goto-statement> = `goto' <identifier>.
 
 <statement> = <assignment> | <procedure-call> | <defer-statement>
-    | <label-declaration> | <goto-statement> |
-    | <while-statement> | <if-statement> | <case-statement>.
+	| <label-declaration> | <goto-statement> | <while-statement>
+	| <if-statement> | <case-statement> | $\varepsilon{}$.
 
-<statement-part> = [`begin' <required-statements>
+<statement-part> = [`begin' <statements>
 	\alt{} `return' <expression>
-	\alt{} `begin' <required-statements> `;' `return' <expression>].
+	\alt{} `begin' <statements> `;' `return' <expression>].
 
 <constant-declaration> = <identifier-definition> `:=' <expression>.
 
-<constant-part> = [`const' \{<constant-declaration> `;'\}].
+<constant-part> = [`const' \{<constant-declaration>\}].
 
 <variable-declaration> = <identifier-definitions> `:\@' <type> \\
 	{[`:=' (<expression> | `extern')]}.
 
-<variable-part> = [`var' \{<variable-declaration> `;'\}].
+<variable-part> = [`var' \{<variable-declaration>\}].
 
 <type-declaration> = <identifier-definition> `=' <type>.
 
-<type-part> = [`type' \{<type-declaration> `;'\}].
+<type-part> = [`type' \{<type-declaration>\}].
 
 <import-declaration> = <identifier> \{`.\@' <identifier>\}.
 
-<import-part> = [`import' \{import-declaration `;'\}].
+<import-part> = [`import' \{import-declaration\}].
 
 <procedure-heading> = `proc' <identifier-definition> \\
 	`(' [<field> \{`,' <field>\}] `)' <return-declaration>.
@@ -170,10 +168,8 @@
 
 <procedure-declaration> = <procedure-heading> `;' (block | `extern').
 
-<declaration-sequence> = <import-part> \\
-    <constant-part> <type-part> <variable-part> \\
-	\{<procedure-declaration> `;'\}.
-
-<program> = `program' `;' <declaration-sequence> <statement-part> `end' `.\@'
-	\alt{} `module' `;' <declaration-sequence> `end' `.\@'.
+<program> = <import-part>
+    <constant-part> <type-part> <variable-part>
+	\{<procedure-declaration>\}
+	<statement-part> `end' `.\@'.
 \end{grammar}
-- 
cgit v1.2.3

