[COMMITTED] algol68: support brief nestable style comments only in SUPPER stropping
Jose E. Marchesi
jemarch@gnu.org
Sun May 18 22:00:52 GMT 2025
Supporting the non-nestable # ... # comment in SUPPER stropping adds
absolutely no value, since backwards compatibility doesn't apply.
---
gcc/algol68/a68-parser-keywords.cc | 2 +-
gcc/algol68/ga68.texi | 40 ++++++++++++-------
.../algol68/compile/char-break-1.a68 | 2 +-
.../compile/error-conformance-clause-1.a68 | 4 +-
.../algol68/compile/error-supper-4.a68 | 4 +-
.../algol68/compile/include-supper.a68 | 9 ++---
gcc/testsuite/algol68/compile/supper-1.a68 | 2 +-
gcc/testsuite/algol68/compile/supper-10.a68 | 4 +-
gcc/testsuite/algol68/compile/supper-11.a68 | 4 +-
gcc/testsuite/algol68/compile/supper-12.a68 | 3 +-
gcc/testsuite/algol68/compile/supper-13.a68 | 5 +--
gcc/testsuite/algol68/compile/supper-2.a68 | 2 +-
gcc/testsuite/algol68/compile/supper-3.a68 | 2 +-
gcc/testsuite/algol68/compile/supper-4.a68 | 2 +-
gcc/testsuite/algol68/compile/supper-5.a68 | 2 +-
gcc/testsuite/algol68/compile/supper-6.a68 | 2 +-
gcc/testsuite/algol68/compile/supper-7.a68 | 2 +-
gcc/testsuite/algol68/compile/supper-8.a68 | 2 +-
gcc/testsuite/algol68/compile/supper-9.a68 | 2 +-
gcc/testsuite/algol68/compile/uniting-1.a68 | 3 +-
.../execute/loop-overflow-underflow.a68 | 8 ++--
.../algol68/execute/serial-dsa-1.a68 | 10 ++---
.../algol68/execute/serial-dsa-2.a68 | 2 +-
.../algol68/execute/serial-dsa-3.a68 | 2 +-
.../algol68/execute/serial-dsa-6.a68 | 2 +-
25 files changed, 62 insertions(+), 60 deletions(-)
diff --git a/gcc/algol68/a68-parser-keywords.cc b/gcc/algol68/a68-parser-keywords.cc
index 1353a2c9e80..030fbf49fef 100644
--- a/gcc/algol68/a68-parser-keywords.cc
+++ b/gcc/algol68/a68-parser-keywords.cc
@@ -137,6 +137,7 @@ a68_set_up_tables (void)
symbols shall be used instead. */
add_keyword (&A68 (top_keyword), STYLE_I_COMMENT_SYMBOL, "CO");
add_keyword (&A68 (top_keyword), BOLD_COMMENT_SYMBOL, "COMMENT");
+ add_keyword (&A68 (top_keyword), STYLE_II_COMMENT_SYMBOL, "#");
add_keyword (&A68 (top_keyword), BOLD_COMMENT_BEGIN_SYMBOL, "NOTE");
add_keyword (&A68 (top_keyword), BOLD_COMMENT_END_SYMBOL, "ETON");
}
@@ -168,7 +169,6 @@ a68_set_up_tables (void)
add_keyword (&A68 (top_keyword), FROM_SYMBOL, "FROM");
add_keyword (&A68 (top_keyword), BOLD_PRAGMAT_SYMBOL, "PRAGMAT");
add_keyword (&A68 (top_keyword), DO_SYMBOL, "DO");
- add_keyword (&A68 (top_keyword), STYLE_II_COMMENT_SYMBOL, "#");
add_keyword (&A68 (top_keyword), CASE_SYMBOL, "CASE");
add_keyword (&A68 (top_keyword), LOC_SYMBOL, "LOC");
add_keyword (&A68 (top_keyword), CHAR_SYMBOL, "CHAR");
diff --git a/gcc/algol68/ga68.texi b/gcc/algol68/ga68.texi
index 4d622e0bf01..59ae1fbfb56 100644
--- a/gcc/algol68/ga68.texi
+++ b/gcc/algol68/ga68.texi
@@ -943,7 +943,20 @@ the compiler. Both are handled at the lexical level.
@node Comments
@section Comments
-This compiler supports three classical Algol 68 comment styles:
+In the default modern stropping regime comments are written between
+@code{@{} and @code{@}} delimiters, and can be nested to arbitrary
+depth. For example:
+
+@example
+foo +:= 1; @{ Increment foo. @}
+@end example
+
+If UPPER stropping is selected, this compiler additionally supports
+three classical Algol 68 comment styles, in which the symbols marking
+the beginning of comments are the same than the symbols marking the
+end of comments and therefore can't be nested: @code{@B{comment}
+... @B{comment}}, @code{@B{co} ... @B{co}} and @code{# .. #}. For
+example:
@example
@B{comment}
@@ -954,15 +967,15 @@ foo := 10; @B{co} this is also a comment @B{co}
foo +:= 1; # and so is this. #
@end example
-@noindent
-As you can see, the symbols marking the beginning of comments are the
-same than the symbols marking the end of comments. This means that
-these comments cannot be nested arbitrarily. No doubt this is the
-reason why there are several of them.
+Unless @option{-std=algol68} is specified in the command line, two
+styles of nestable comments can be also used with UPPER stropping: the
+already explained @code{@{ ... @}} and a ``bold'' style that uses
+@code{@B{code} ... @B{edoc}}. For example:
-This compiler also supports @dfn{nestable comments}, which are a GNU
-extension and are available unless strict Algol 68 support is
-requested. There are two styles of nestable comments:
+@example
+foo := 10; @{ this is a nestable comment in brief style. @}
+foo +:= 1; @B{note} this is a nestable comment in bold style. @B{eton}.
+@end example
@example
@B{note}
@@ -972,12 +985,9 @@ requested. There are two styles of nestable comments:
@{ "Brief" nestable comments. @}
@end example
-In UPPER stropping all comment styles are available. In SUPPER
-stropping, which is based on reserved words, only @code{# ... #} and
-@code{@{ ... @}} comments are available.
-
-It is recommended to use brief nestable comments in new Algol 68
-programs regardless of the stropping regime used.
+In UPPER stropping all comment styles are available, both classic and
+nestable. In modern SUPPER stropping, which is based on reserved
+words, only @code{# ... #} is available.
@node Pragmats
@section Pragmats
diff --git a/gcc/testsuite/algol68/compile/char-break-1.a68 b/gcc/testsuite/algol68/compile/char-break-1.a68
index 00037a0103b..8a43364919f 100644
--- a/gcc/testsuite/algol68/compile/char-break-1.a68
+++ b/gcc/testsuite/algol68/compile/char-break-1.a68
@@ -1,4 +1,4 @@
-# Make sure char denotations with string breaks work. #
+{ Make sure char denotations with string breaks work. }
begin prio % = 9;
op % = (char a) char: a;
assert (ABS %"'n" = 10);
diff --git a/gcc/testsuite/algol68/compile/error-conformance-clause-1.a68 b/gcc/testsuite/algol68/compile/error-conformance-clause-1.a68
index 17aca7ceb22..e6cb738a2c9 100644
--- a/gcc/testsuite/algol68/compile/error-conformance-clause-1.a68
+++ b/gcc/testsuite/algol68/compile/error-conformance-clause-1.a68
@@ -1,6 +1,6 @@
-# This is an invalid program. #
+{ This is an invalid program. }
begin case
- if true then "foo" else 10 fi # { dg-error "not a united mode" } #
+ if true then "foo" else 10 fi { dg-error "not a united mode" }
in (string): skip,
(int): skip
esac
diff --git a/gcc/testsuite/algol68/compile/error-supper-4.a68 b/gcc/testsuite/algol68/compile/error-supper-4.a68
index 18f2e6cc68c..726f80638d6 100644
--- a/gcc/testsuite/algol68/compile/error-supper-4.a68
+++ b/gcc/testsuite/algol68/compile/error-supper-4.a68
@@ -1,5 +1,5 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
-begin int foo bar = 10; # { dg-error "" } #
+begin int foo bar = 10; { dg-error "" }
skip
end
diff --git a/gcc/testsuite/algol68/compile/include-supper.a68 b/gcc/testsuite/algol68/compile/include-supper.a68
index 3b424b1bb0f..af0521be101 100644
--- a/gcc/testsuite/algol68/compile/include-supper.a68
+++ b/gcc/testsuite/algol68/compile/include-supper.a68
@@ -1,11 +1,10 @@
-# { dg-options "-I$srcdir/algol68/compile/a68includes" } #
-# { dg-additional-files "$srcdir/algol68/compile/a68includes/hello-supper.a68 $srcdir/algol68/compile/a68includes/goodbye-supper.a68" } #
+{ dg-options "-I$srcdir/algol68/compile/a68includes" }
+{ dg-additional-files "$srcdir/algol68/compile/a68includes/hello-supper.a68 $srcdir/algol68/compile/a68includes/goodbye-supper.a68" }
begin string name := "Algol68 with supper!";
- # Both files are in `./a68includes'.
+ { Both files are in `./a68includes'.
The first one will be included because we uwed `-I.
- The second one will be included because of the relative path.
- #
+ The second one will be included because of the relative path. }
pr include "hello-supper.a68" pr
pr include "a68includes/goodbye-supper.a68" pr
diff --git a/gcc/testsuite/algol68/compile/supper-1.a68 b/gcc/testsuite/algol68/compile/supper-1.a68
index 69a46d287da..a572f1e929f 100644
--- a/gcc/testsuite/algol68/compile/supper-1.a68
+++ b/gcc/testsuite/algol68/compile/supper-1.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin mode Some_Mode = real;
Some_Mode some_real := random;
diff --git a/gcc/testsuite/algol68/compile/supper-10.a68 b/gcc/testsuite/algol68/compile/supper-10.a68
index 324846ea6d7..5c661a677f4 100644
--- a/gcc/testsuite/algol68/compile/supper-10.a68
+++ b/gcc/testsuite/algol68/compile/supper-10.a68
@@ -1,6 +1,4 @@
-# { dg-options {-fstropping=supper} } #
-
-{ foo }
+{ dg-options {-fstropping=supper} }
begin mode BEGIN = int;
BEGIN some_int = 10;
diff --git a/gcc/testsuite/algol68/compile/supper-11.a68 b/gcc/testsuite/algol68/compile/supper-11.a68
index 324846ea6d7..5c661a677f4 100644
--- a/gcc/testsuite/algol68/compile/supper-11.a68
+++ b/gcc/testsuite/algol68/compile/supper-11.a68
@@ -1,6 +1,4 @@
-# { dg-options {-fstropping=supper} } #
-
-{ foo }
+{ dg-options {-fstropping=supper} }
begin mode BEGIN = int;
BEGIN some_int = 10;
diff --git a/gcc/testsuite/algol68/compile/supper-12.a68 b/gcc/testsuite/algol68/compile/supper-12.a68
index e7ffecc642a..497a88a2e66 100644
--- a/gcc/testsuite/algol68/compile/supper-12.a68
+++ b/gcc/testsuite/algol68/compile/supper-12.a68
@@ -1,5 +1,4 @@
-# { dg-options {-fstropping=supper} } #
-# PR SUPPER PR #
+{ dg-options {-fstropping=supper} }
begin for i while i < 10
do puts ("lala\n")
diff --git a/gcc/testsuite/algol68/compile/supper-13.a68 b/gcc/testsuite/algol68/compile/supper-13.a68
index f82211bf9aa..5e17fb4832c 100644
--- a/gcc/testsuite/algol68/compile/supper-13.a68
+++ b/gcc/testsuite/algol68/compile/supper-13.a68
@@ -1,7 +1,6 @@
-# { dg-options "-fstropping=supper" } #
-# PR SUPPER PR #
+{ dg-options "-fstropping=supper" }
-# mode_ should not be recognized as a symbol. #
+{ mode_ should not be recognized as a symbol. }
begin int mode_ = 10;
skip
diff --git a/gcc/testsuite/algol68/compile/supper-2.a68 b/gcc/testsuite/algol68/compile/supper-2.a68
index cbfd17517d0..04d5f0f461f 100644
--- a/gcc/testsuite/algol68/compile/supper-2.a68
+++ b/gcc/testsuite/algol68/compile/supper-2.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin int foo_bar = 10;
skip
diff --git a/gcc/testsuite/algol68/compile/supper-3.a68 b/gcc/testsuite/algol68/compile/supper-3.a68
index b78c027a799..4cc711b9132 100644
--- a/gcc/testsuite/algol68/compile/supper-3.a68
+++ b/gcc/testsuite/algol68/compile/supper-3.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin int foo_bar_ = 10;
skip
diff --git a/gcc/testsuite/algol68/compile/supper-4.a68 b/gcc/testsuite/algol68/compile/supper-4.a68
index fc5104b706b..283be9a4735 100644
--- a/gcc/testsuite/algol68/compile/supper-4.a68
+++ b/gcc/testsuite/algol68/compile/supper-4.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin int foo_ = 10;
skip
diff --git a/gcc/testsuite/algol68/compile/supper-5.a68 b/gcc/testsuite/algol68/compile/supper-5.a68
index 6b8bf8642d7..b3ffd899e5c 100644
--- a/gcc/testsuite/algol68/compile/supper-5.a68
+++ b/gcc/testsuite/algol68/compile/supper-5.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin mode Foo_bar = int;
Foo_bar some_int = 10;
diff --git a/gcc/testsuite/algol68/compile/supper-6.a68 b/gcc/testsuite/algol68/compile/supper-6.a68
index e61dce8cc18..37fc5e6f3c2 100644
--- a/gcc/testsuite/algol68/compile/supper-6.a68
+++ b/gcc/testsuite/algol68/compile/supper-6.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin go to done;
done: skip
diff --git a/gcc/testsuite/algol68/compile/supper-7.a68 b/gcc/testsuite/algol68/compile/supper-7.a68
index f8cb2de0af2..a3741748b4c 100644
--- a/gcc/testsuite/algol68/compile/supper-7.a68
+++ b/gcc/testsuite/algol68/compile/supper-7.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin goto done;
done: skip
diff --git a/gcc/testsuite/algol68/compile/supper-8.a68 b/gcc/testsuite/algol68/compile/supper-8.a68
index df0cd7c14ed..363d9b483ca 100644
--- a/gcc/testsuite/algol68/compile/supper-8.a68
+++ b/gcc/testsuite/algol68/compile/supper-8.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin mode Int = int;
Int some_int = 10;
diff --git a/gcc/testsuite/algol68/compile/supper-9.a68 b/gcc/testsuite/algol68/compile/supper-9.a68
index 3014909bc9b..5c661a677f4 100644
--- a/gcc/testsuite/algol68/compile/supper-9.a68
+++ b/gcc/testsuite/algol68/compile/supper-9.a68
@@ -1,4 +1,4 @@
-# { dg-options {-fstropping=supper} } #
+{ dg-options {-fstropping=supper} }
begin mode BEGIN = int;
BEGIN some_int = 10;
diff --git a/gcc/testsuite/algol68/compile/uniting-1.a68 b/gcc/testsuite/algol68/compile/uniting-1.a68
index e1fcd6fccff..057c4f85838 100644
--- a/gcc/testsuite/algol68/compile/uniting-1.a68
+++ b/gcc/testsuite/algol68/compile/uniting-1.a68
@@ -1,5 +1,4 @@
-# { dg-options {-fstropping=supper} } #
-# PR SUPPER #
+{ dg-options {-fstropping=supper} }
begin mode JSON_Val = union (int,ref JSON_Obj),
JSON_Obj = struct (int je),
diff --git a/gcc/testsuite/algol68/execute/loop-overflow-underflow.a68 b/gcc/testsuite/algol68/execute/loop-overflow-underflow.a68
index 4a0984506c6..1ace68aff0f 100644
--- a/gcc/testsuite/algol68/execute/loop-overflow-underflow.a68
+++ b/gcc/testsuite/algol68/execute/loop-overflow-underflow.a68
@@ -1,9 +1,9 @@
-# Test for overflow/underflow in loops with implicit and explicit
- iterators. #
+{ Test for overflow/underflow in loops with implicit and explicit
+ iterators. }
begin int count;
- # Overflow. #
+ { Overflow. }
count := 0;
by 1 while true do count +:= 1 od;
assert (count = max_int);
@@ -28,7 +28,7 @@ begin int count;
by max_int - 1 do count +:= 1 od;
assert (count = 2);
- # Underflow. #
+ { Underflow. }
count := 0;
by -1 while true do count +:= 1 od;
assert (count = -min_int + 2);
diff --git a/gcc/testsuite/algol68/execute/serial-dsa-1.a68 b/gcc/testsuite/algol68/execute/serial-dsa-1.a68
index e49e95bf4f4..b27ad8c7793 100644
--- a/gcc/testsuite/algol68/execute/serial-dsa-1.a68
+++ b/gcc/testsuite/algol68/execute/serial-dsa-1.a68
@@ -1,16 +1,16 @@
-# This tests stack management for DSA serial clauses.
- If it fails a stack overflow happens. #
-begin # DSA due to stack allocated multiple. #
+{ This tests stack management for DSA serial clauses.
+ If it fails a stack overflow happens. }
+begin { DSA due to stack allocated multiple. }
to 10000
do [10000]int foo;
skip
od;
- # DSA due to stack allocated multiple. Explicit loc. #
+ { DSA due to stack allocated multiple. Explicit loc. }
to 10000
do loc[10000]int foo;
skip
od;
- # DSA due to loc generator. #
+ { DSA due to loc generator. }
to 10000
do ref[]int jorl = loc [10000]int;
skip
diff --git a/gcc/testsuite/algol68/execute/serial-dsa-2.a68 b/gcc/testsuite/algol68/execute/serial-dsa-2.a68
index ea8a0fd47a2..45ad0497ea8 100644
--- a/gcc/testsuite/algol68/execute/serial-dsa-2.a68
+++ b/gcc/testsuite/algol68/execute/serial-dsa-2.a68
@@ -1,4 +1,4 @@
-# Check value yielding of DSA serial clauses. #
+{ Check value yielding of DSA serial clauses. }
begin assert ((ref int foo = loc int := 100;
foo) = 100);
assert (([10000]int foo; foo[10] := 666; foo)[10] = 666)
diff --git a/gcc/testsuite/algol68/execute/serial-dsa-3.a68 b/gcc/testsuite/algol68/execute/serial-dsa-3.a68
index 3d2a1ea4542..7cb96dde3c6 100644
--- a/gcc/testsuite/algol68/execute/serial-dsa-3.a68
+++ b/gcc/testsuite/algol68/execute/serial-dsa-3.a68
@@ -1,4 +1,4 @@
-# The jump to leak should not leak stack. #
+{ The jump to leak should not leak stack. }
begin by 10000
do
by 10000
diff --git a/gcc/testsuite/algol68/execute/serial-dsa-6.a68 b/gcc/testsuite/algol68/execute/serial-dsa-6.a68
index 8e6d593d29e..fb17d2d6442 100644
--- a/gcc/testsuite/algol68/execute/serial-dsa-6.a68
+++ b/gcc/testsuite/algol68/execute/serial-dsa-6.a68
@@ -1,4 +1,4 @@
-# DSA and completers in a serial clause. #
+{ DSA and completers in a serial clause. }
begin assert ((ref int a = loc int := 10; a exit foo: a +:= 1) + 1 = 11);
skip
end
--
2.30.2
More information about the Algol68
mailing list