Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -1,75 +1,51 @@
# recursively reverses the current word in the input and returns the #
# the character that followed it #
# "ch" should contain the first letter of the word on entry and will be #
# updated to the punctuation following the word on exit #
PROC reverse word = ( REF CHAR ch )VOID:
BEGIN
CHAR next ch;
read( ( next ch ) );
IF ( next ch <= "Z" AND next ch >= "A" )
OR ( next ch <= "z" AND next ch >= "a" )
THEN
reverse word( next ch )
FI;
print( ( ch ) );
ch := next ch
END; # reverse word #
# recursively prints the current word in the input and returns the #
# character that followed it #
# "ch" should contain the first letter of the word on entry and will be #
# updated to the punctuation following the word on exit #
PROC normal word = ( REF CHAR ch )VOID:
BEGIN
print( ( ch ) );
read ( ( ch ) );
IF ( ch <= "Z" AND ch >= "A" )
OR ( ch <= "z" AND ch >= "a" )
THEN
normal word( ch )
FI
END; # normal word #
# read and print words and punctuation from the input stream, reversing #
# every second word #
PROC reverse every other word = VOID:
BEGIN
CHAR ch;
read( ( ch ) );
WHILE
ch /= "."
DO
normal word( ch );
IF ch /= "."
THEN
# recursively reverses the current word in the input and returns the #
# the character that followed it #
# "ch" should contain the first letter of the word on entry and will be #
# updated to the punctuation following the word on exit #
PROC reverse word = ( REF CHAR ch )VOID:
BEGIN
CHAR next ch;
read( ( next ch ) );
IF ( next ch <= "Z" AND next ch >= "A" )
OR ( next ch <= "z" AND next ch >= "a" )
THEN
reverse word( next ch )
FI;
print( ( ch ) );
ch := next ch
END # reverse word # ;
# recursively prints the current word in the input and returns the #
# character that followed it #
# "ch" should contain the first letter of the word on entry and will be #
# updated to the punctuation following the word on exit #
PROC normal word = ( REF CHAR ch )VOID:
IF print( ( ch ) );
read ( ( ch ) );
reverse word( ch )
FI
OD;
( ch <= "Z" AND ch >= "A" )
OR ( ch <= "z" AND ch >= "a" )
THEN
normal word( ch )
FI # normal word # ;
print( ( ch ) )
# read and print words and punctuation from the input stream, reversing #
# every second word #
PROC reverse every other word = VOID:
BEGIN
CHAR ch;
read( ( ch ) );
WHILE ch /= "." DO
normal word( ch );
IF ch /= "." THEN
print( ( ch ) );
read ( ( ch ) );
reverse word( ch )
FI
OD;
print( ( ch ) )
END; # reverse every other word #
END; # reverse every other word #
main: (
reverse every other word
)
END