Use of sppp.awk, part 2
chris hermansen
clhermansen@gmail.com
Thu Feb 12 23:07:07 GMT 2026
Hello again everyone,
I ran across the operator ADD in van Vliet and recoded it using sppp.awk as
per Jose's writings of awhile back:
prio {ℵ₀} ADD = 1;
op
{iter L {short short} {short} {} {long} {long long}
K {SHORTEN SHORTEN} {SHORTEN} {} {LENG} {LENG}
xlx {short_short_} {short_} {} {long_} {long_long_}}
ADD = (ref {L} int a, int d) bool:
if {L} int amax = {xlx}max_int OVER {L} 10,
dmax = {xlx}max_int MOD {L} 10;
a > amax OR a = amax AND {K} d > dmax
then false
else a:= {L} 10 * a + {K} d; true
fi
{reti {,}}
;
This does not seem to produce anything like what I expect, which would be 5
definitions of op ADD for different int lengths, with K and xlx
interpolated to match L.
Instead I see this:
prio {ℵ₀} ADD = 1;
op
K {SHORTEN SHORTEN} {SHORTEN} {} {LENG} {LENG}
xlx {short_short_} {short_} {} {long_} {long_long_}}
ADD = (ref short short int a, int d) bool:
if short short int amax = {xlx}max_int OVER short short 10,
dmax = {xlx}max_int MOD short short 10;
a > amax OR a = amax AND {K} d > dmax
then false
else a:= short short 10 * a + {K} d; true
fi,
K {SHORTEN SHORTEN} {SHORTEN} {} {LENG} {LENG}
xlx {short_short_} {short_} {} {long_} {long_long_}}
ADD = (ref short int a, int d) bool:
if short int amax = {xlx}max_int OVER short 10,
dmax = {xlx}max_int MOD short 10;
a > amax OR a = amax AND {K} d > dmax
then false
else a:= short 10 * a + {K} d; true
fi,
K {SHORTEN SHORTEN} {SHORTEN} {} {LENG} {LENG}
xlx {short_short_} {short_} {} {long_} {long_long_}}
ADD = (ref int a, int d) bool:
if int amax = {xlx}max_int OVER 10,
dmax = {xlx}max_int MOD 10;
a > amax OR a = amax AND {K} d > dmax
then false
else a:= 10 * a + {K} d; true
fi,
K {SHORTEN SHORTEN} {SHORTEN} {} {LENG} {LENG}
xlx {short_short_} {short_} {} {long_} {long_long_}}
ADD = (ref long int a, int d) bool:
if long int amax = {xlx}max_int OVER long 10,
dmax = {xlx}max_int MOD long 10;
a > amax OR a = amax AND {K} d > dmax
then false
else a:= long 10 * a + {K} d; true
fi,
K {SHORTEN SHORTEN} {SHORTEN} {} {LENG} {LENG}
xlx {short_short_} {short_} {} {long_} {long_long_}}
ADD = (ref long long int a, int d) bool:
if long long int amax = {xlx}max_int OVER long long 10,
dmax = {xlx}max_int MOD long long 10;
a > amax OR a = amax AND {K} d > dmax
then false
else a:= long long 10 * a + {K} d; true
fi
;
Is the "synchronized iterator" concept not yet implemented?
--
Chris Hermansen · clhermansen "at" gmail "dot" com
C'est ma façon de parler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/algol68/attachments/20260212/e6e0afb0/attachment.htm>
More information about the Algol68
mailing list