[COMMITTED] algol68: add syntax for the SC GNU extension to ga68.vw

Jose E. Marchesi jemarch@gnu.org
Sat Apr 19 19:39:21 GMT 2025


---
 gcc/algol68/ga68.vw | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gcc/algol68/ga68.vw b/gcc/algol68/ga68.vw
index ec984b2a2cc..f645d2cbea6 100644
--- a/gcc/algol68/ga68.vw
+++ b/gcc/algol68/ga68.vw
@@ -25,6 +25,11 @@
        the compiler to avoid certain diagnostics.  See the GNU Algol
        68 Compiler manual for more information.
 
+  [SC] This is the GNU68-2025-003-andth-orel GNU extension.  It adds
+       two units that act as pseudo-operators providing logical AND
+       and OR functions with short-circuited elaboration.  See the GNU
+       Algol 68 Compiler manual for more information.
+
   [MR] A modules and separated compilation system based on the modules
        system recomended by IFIP Working Group 2.1 Standing
        Subcommittee on Algol 68 Support, described in:
@@ -982,6 +987,7 @@ g) *module text :
 A) UNIT{32d} ::
      assignation{521a} coercee ; identity relation{522a} coercee ;
      routine text{541a,b} coercee ; jump{544a} ; skip{552a} ;
+     and function{57a} ; or function{57b} ;
      formal hole{561b} ; virtual hole{561a} ;
      TERTIARY{B}.
 B) TERTIARY{A,521b,522a} ::
@@ -1236,6 +1242,27 @@ f) MOID DLANG indication{b} : bold letter d letter l letter a letter n
   mechanism is provided (10.6.2.a) for constructing them out of
   formal- and actual-holes. }
 
+5.7 Short-circuit logical functions
+
+{ Extensions: [SC] }
+
+{ The short-circuit logical functions are pseudo-operators providing
+  logical AND and OR functions with short-circuited elaboration.  }
+
+5.7.1 Syntax
+
+a) boolean NEST and function{5A} :
+     boolean NEST TERTIARY1, short circuit function{b},
+       boolean NEST TERTIARY2.
+
+b) short circuit function{a} : andth{94c} token ; orel{94c} token.
+
+{ Examples:
+    a) UPB str > 2 ANDTH str[3] /= "x"
+       error = 0 OREL (print ("error"); stop; SKIP)
+    b) ANDTH
+       OREL }
+
 6 Coercion
 
 6.1 Coercees
@@ -1400,6 +1427,7 @@ b) voided to{61A} void COMORF :
 9.4.1 Representations of symbols
 
 { Extensions:
+  [CS] andth symbol, orel symbol
   [MR] access symbol
   [US] unsafe symbol }
 
@@ -1410,6 +1438,8 @@ b) voided to{61A} void COMORF :
 
         symbol                         representation
 
+c) andth symbol{57b}                    ANDTH
+   orel symbol{57b}                     OREL
 d) access symbol{36b}                   ACCESS
 f) unsafe symbol{37a}                   UNSAFE
 
-- 
2.30.2



More information about the Algol68 mailing list