[COMMITTED] Revert "a68: do not use `^' for the pow operator"
Jose E. Marchesi
jemarch@gnu.org
Sat Jan 24 16:20:51 GMT 2026
By popular demand the symbol ^ is reinstated as the representation for
pow, along with **.
This reverts commit cb557adb00b69f75025485e991e07cb93008e029.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
---
gcc/algol68/a68-parser-prelude.cc | 18 ++++++++++++++++++
gcc/algol68/ga68.texi | 5 ++++-
gcc/testsuite/algol68/execute/pow-real-1.a68 | 6 +++---
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/gcc/algol68/a68-parser-prelude.cc b/gcc/algol68/a68-parser-prelude.cc
index 84d1e1eb68b..b28df455aa2 100644
--- a/gcc/algol68/a68-parser-prelude.cc
+++ b/gcc/algol68/a68-parser-prelude.cc
@@ -518,6 +518,7 @@ stand_prelude (void)
a68_prio ("SHR", 8);
a68_prio ("UP", 8);
a68_prio ("DOWN", 8);
+ a68_prio ("^", 8);
a68_prio ("LWB", 8);
a68_prio ("UPB", 8);
a68_prio ("I", 9);
@@ -633,6 +634,7 @@ stand_prelude (void)
a68_op (A68_STD, "/=", m, a68_lower_int_ne3);
m = a68_proc (M_SHORT_SHORT_INT, M_SHORT_SHORT_INT, M_INT, NO_MOID);
a68_op (A68_STD, "**", m, a68_lower_pow_int);
+ a68_op (A68_STD, "^", m, a68_lower_pow_int);
/* SHORT INT operators. */
m = a68_proc (M_SHORT_INT, M_SHORT_INT, NO_MOID);
a68_op (A68_STD, "+", m, a68_lower_confirm2);
@@ -679,6 +681,7 @@ stand_prelude (void)
a68_op (A68_STD, "GE", m, a68_lower_int_ge3);
m = a68_proc (M_SHORT_INT, M_SHORT_INT, M_INT, NO_MOID);
a68_op (A68_STD, "**", m, a68_lower_pow_int);
+ a68_op (A68_STD, "^", m, a68_lower_pow_int);
/* INT operators. */
m = a68_proc (M_INT, M_INT, NO_MOID);
a68_op (A68_STD, "+", m, a68_lower_confirm2);
@@ -713,6 +716,7 @@ stand_prelude (void)
a68_op (A68_STD, "MOD", m, a68_lower_mod3);
a68_op (A68_STD, "%*", m, a68_lower_mod3);
a68_op (A68_STD, "**", m, a68_lower_pow_int);
+ a68_op (A68_STD, "^", m, a68_lower_pow_int);
m = a68_proc (M_REAL, M_INT, M_INT, NO_MOID);
a68_op (A68_STD, "/", m, a68_lower_rdiv3);
m = a68_proc (M_REF_INT, M_REF_INT, M_INT, NO_MOID);
@@ -774,6 +778,7 @@ stand_prelude (void)
a68_op (A68_STD, "/", m, a68_lower_rdiv3);
m = a68_proc (M_LONG_INT, M_LONG_INT, M_INT, NO_MOID);
a68_op (A68_STD, "**", m, a68_lower_pow_int);
+ a68_op (A68_STD, "^", m, a68_lower_pow_int);
/* LONG LONG INT operators. */
m = a68_proc (M_LONG_LONG_INT, M_LONG_LONG_INT, NO_MOID);
a68_op (A68_STD, "+", m, a68_lower_confirm2);
@@ -821,6 +826,7 @@ stand_prelude (void)
a68_op (A68_STD, "/=", m, a68_lower_int_ne3);
m = a68_proc (M_LONG_LONG_INT, M_LONG_LONG_INT, M_INT, NO_MOID);
a68_op (A68_STD, "**", m, a68_lower_pow_int);
+ a68_op (A68_STD, "^", m, a68_lower_pow_int);
/* SHORT SHORT BITS operators */
m = a68_proc (M_BOOL, M_SHORT_SHORT_BITS, M_SHORT_SHORT_BITS, NO_MOID);
a68_op (A68_STD, "=", m, a68_lower_bit_eq3);
@@ -1000,8 +1006,10 @@ stand_prelude (void)
a68_op (A68_STD, "*", m, a68_lower_mult_real);
a68_op (A68_STD, "/", m, a68_lower_div3);
a68_op (A68_STD, "**", m, a68_lower_pow_real);
+ a68_op (A68_STD, "^", m, a68_lower_pow_real);
m = a68_proc (M_REAL, M_REAL, M_INT, NO_MOID);
a68_op (A68_STD, "**", m, a68_lower_pow_real);
+ a68_op (A68_STD, "^", m, a68_lower_pow_real);
m = a68_proc (M_REF_REAL, M_REF_REAL, M_REAL, NO_MOID);
a68_op (A68_STD, "+:=", m, a68_lower_plusab3);
a68_op (A68_STD, "-:=", m, a68_lower_minusab3);
@@ -1033,6 +1041,7 @@ stand_prelude (void)
a68_op (A68_STD, "*", m, a68_lower_mult_real);
a68_op (A68_STD, "/", m, a68_lower_div3);
a68_op (A68_STD, "**", m, a68_lower_pow_real);
+ a68_op (A68_STD, "^", m, a68_lower_pow_real);
m = a68_proc (M_REF_LONG_REAL, M_REF_LONG_REAL, M_LONG_REAL, NO_MOID);
a68_op (A68_STD, "+:=", m, a68_lower_plusab3);
a68_op (A68_STD, "-:=", m, a68_lower_minusab3);
@@ -1057,6 +1066,7 @@ stand_prelude (void)
a68_op (A68_STD, "GE", m, a68_lower_real_ge3);
m = a68_proc (M_LONG_REAL, M_LONG_REAL, M_INT, NO_MOID);
a68_op (A68_STD, "**", m, a68_lower_pow_real);
+ a68_op (A68_STD, "^", m, a68_lower_pow_real);
/* LONG LONG REAL operators. */
m = a68_proc (M_LONG_REAL, M_LONG_LONG_REAL, NO_MOID);
a68_op (A68_STD, "SHORTEN", m, a68_lower_shortenreal2);
@@ -1075,6 +1085,7 @@ stand_prelude (void)
a68_op (A68_STD, "*", m, a68_lower_mult_real);
a68_op (A68_STD, "/", m, a68_lower_div3);
a68_op (A68_STD, "**", m, a68_lower_pow_real);
+ a68_op (A68_STD, "^", m, a68_lower_pow_real);
m = a68_proc (M_REF_LONG_LONG_REAL, M_REF_LONG_LONG_REAL, M_LONG_LONG_REAL, NO_MOID);
a68_op (A68_STD, "+:=", m, a68_lower_plusab3);
a68_op (A68_STD, "-:=", m, a68_lower_minusab3);
@@ -1099,6 +1110,7 @@ stand_prelude (void)
a68_op (A68_STD, "GE", m, a68_lower_real_ge3);
m = a68_proc (M_LONG_LONG_REAL, M_LONG_LONG_REAL, M_INT, NO_MOID);
a68_op (A68_STD, "**", m, a68_lower_pow_real);
+ a68_op (A68_STD, "^", m, a68_lower_pow_real);
/* ROWS operators. */
m = a68_proc (M_INT, M_ROWS, NO_MOID);
a68_op (A68_STD, "LWB", m, a68_lower_lwb2);
@@ -1184,6 +1196,8 @@ stand_prelude (void)
a68_op (A68_STD, "/", m);
m = a68_proc (M_COMPLEX, M_COMPLEX, M_INT, NO_MOID);
a68_op (A68_STD, "**", m);
+ a68_op (A68_STD, "UP", m);
+ a68_op (A68_STD, "^", m);
m = a68_proc (M_REF_COMPLEX, M_REF_COMPLEX, M_COMPLEX, NO_MOID);
a68_op (A68_STD, "+:=", m);
a68_op (A68_STD, "-:=", m);
@@ -1226,6 +1240,8 @@ stand_prelude (void)
a68_op (A68_STD, "/", m);
m = a68_proc (M_LONG_COMPLEX, M_LONG_COMPLEX, M_INT, NO_MOID);
a68_op (A68_STD, "**", m);
+ a68_op (A68_STD, "UP", m);
+ a68_op (A68_STD, "^", m);
m = a68_proc (M_BOOL, M_LONG_COMPLEX, M_LONG_COMPLEX, NO_MOID);
a68_op (A68_STD, "=", m);
a68_op (A68_STD, "EQ", m);
@@ -1263,6 +1279,8 @@ stand_prelude (void)
a68_op (A68_STD, "/", m);
m = a68_proc (M_LONG_LONG_COMPLEX, M_LONG_LONG_COMPLEX, M_INT, NO_MOID);
a68_op (A68_STD, "**", m);
+ a68_op (A68_STD, "UP", m);
+ a68_op (A68_STD, "^", m);
m = a68_proc (M_BOOL, M_LONG_LONG_COMPLEX, M_LONG_LONG_COMPLEX, NO_MOID);
a68_op (A68_STD, "=", m);
a68_op (A68_STD, "EQ", m);
diff --git a/gcc/algol68/ga68.texi b/gcc/algol68/ga68.texi
index c785b3920c1..7ee12ffb050 100644
--- a/gcc/algol68/ga68.texi
+++ b/gcc/algol68/ga68.texi
@@ -2101,6 +2101,7 @@ target.
@item @code{@B{shl}}, @code{@B{up}}
@item @code{@B{shr}}, @code{@B{down}}
@item @code{@B{up}}, @code{@B{down}}
+@item @code{^}
@item @code{@B{lwb}}
@item @code{@B{upb}}
@end itemize
@@ -2233,6 +2234,7 @@ Dyadic operator that yields the integer division with real result of
@end deftypefn
@deftypefn Operator {} {**} {= (@B{l} @B{int} a, b) @B{l} @B{int}}
+@deftypefnx Operator {} {^} {= (@B{l} @B{int} a, b) @B{l} @B{int}}
Dyadic operator that yields @code{a} raised to the exponent @code{b}.
@end deftypefn
@@ -2366,10 +2368,12 @@ Dyadic operator that yields the realeger division with real result of
@end deftypefn
@deftypefn Operator {} {**} {= (@B{l} @B{real} a, b) @B{l} @B{real}}
+@deftypefnx Operator {} {^} {= (@B{l} @B{real} a, b) @B{l} @B{real}}
Dyadic operator that yields @code{a} raised to the real exponent @code{b}.
@end deftypefn
@deftypefn Operator {} {**} {= (@B{l} @B{real} a, @B{int} b) @B{l} @B{real}}
+@deftypefnx Operator {} {^} {= (@B{l} @B{real} a, @B{int} b) @B{l} @B{real}}
Dyadic operator that yields @code{a} raised to the integral exponent
@code{b}.
@end deftypefn
@@ -3326,4 +3330,3 @@ sometimes be useful to look up both forms.
@printindex cp
@bye
-b
diff --git a/gcc/testsuite/algol68/execute/pow-real-1.a68 b/gcc/testsuite/algol68/execute/pow-real-1.a68
index 69d84759080..81028706485 100644
--- a/gcc/testsuite/algol68/execute/pow-real-1.a68
+++ b/gcc/testsuite/algol68/execute/pow-real-1.a68
@@ -1,7 +1,7 @@
# { dg-options "-fstropping=upper" } #
BEGIN REAL r0 = 2.0; LONG REAL rr0 = LONG 2.0; LONG LONG REAL rrr0 = LONG LONG 2.0;
- REAL r1 = r0 ** 2; REAL r2 = r0 ** 3.0;
- LONG REAL rr1 = rr0 ** LONG 2; LONG REAL rr2 = rr0 ** LONG 3.0;
- LONG LONG REAL rrr1 = rrr0 ** LONG LONG 2; LONG LONG REAL rrr2 = rrr0 ** LONG LONG 3.0;
+ REAL r1 = r0 ^ 2; REAL r2 = r0 ^ 3.0;
+ LONG REAL rr1 = rr0 ^ LONG 2; LONG REAL rr2 = rr0 ^ LONG 3.0;
+ LONG LONG REAL rrr1 = rrr0 ^ LONG LONG 2; LONG LONG REAL rrr2 = rrr0 ^ LONG LONG 3.0;
SKIP
END
--
2.39.5
More information about the Algol68
mailing list