##:/
/(Problem A. Speaking in Tongues in Sorted!)
/(Interpreter/compiler is available at http://smithers.net63.net/sorted)
/(See also http://p-nand-q.com/humor/programming_languages/sorted.html)
This code uses the numbers
/(General)
two hundred, /(The stack pointer)
zero,
one,
/(Numeric I/O)
ten, /(10 = '\n')
/(5) forty seven, /('0'-1)
forty eight, /('0')
two, /(The character that was read, initialiser doesn't matter)
three, /(The value to be I/Oed. aka NIOVal, initialiser doesn't matter)
/(Program)
two hundred and two, /(Return reference for after_reading_case_count)
/(10) two hundred and three, /(Return reference for after_writing_case_number)
seventy nine, /('a'-)
four, /(The number of cases, initialiser doesn't matter)
five, /(The current case number, initialiser doesn't matter)
sixty seven, /('C')
/(15) thirty two, /(' ')
thirty five, /('#')
fifty eight, /(':' = '9'+1)
one hundred and twenty one, /('y')
one hundred and four, /('h')
/(20) one hundred and one, /('e')
one hundred and fifteen, /('s')
one hundred and eleven, /('o')
ninety nine, /('c')
one hundred and eighteen, /('v')
/(25) one hundred and twenty, /('x')
one hundred, /('d')
one hundred and seventeen, /('u')
one hundred and five, /('i')
one hundred and three, /('g')
/(30) one hundred and eight, /('l')
ninety eight, /('b')
one hundred and seven, /('k')
one hundred and fourteen, /('r')
one hundred and twenty two, /('z')
/(35) one hundred and sixteen, /('t')
one hundred and ten, /('n')
one hundred and nineteen, /('w')
one hundred and six, /('j')
one hundred and twelve, /('p')
/(40) one hundred and two, /('f')
one hundred and nine, /('m')
ninety seven, and /('a')
one hundred and thirteen. /('q')
This code
/(General)
always goes to the first label, /(Goes to the trampoline)
/(Numeric I/O)
always goes to the second label, /(Read a value)
sometimes goes to the second label if the first logical operation is true, /(Keep skipping nondigits)
sometimes goes to the third label if the second logical operation is true, /(Keep reading digits)
/(5) always goes to the fourth label, /(Write a value)
sometimes goes to the fifth label if the third logical operation is true, /(Keep pushing digits to print)
sometimes goes to the sixth label if the fourth logical operation is true, /(Keep printing digits)
/(Program)
sometimes goes to the seventh label if the fifth condition is true, /(Return to after_reading_case_count)
sometimes goes to the eighth label if the sixth condition is true, /(Return to after_writing_case_number)
/(10) sometimes goes to the twelveth label if the seventh condition is true, /(Stop after last case)
sometimes goes to the tenth label if the nineth condition is true, /(Don't translate ' ')
sometimes goes to the eleventh label if the eighth condition is true, /(End of case)
always goes to the thirteenth label, and /(Inner loop)
always goes to the nineth label. /(Outer loop)
This code writes
/(Numeric I/O)
the cell indexed by the first number as a character, /(Write a digit from the stack)
/(Program)
the fourteenth number as a character, /(Write 'C')
the fortysecond number as a character, /(Write 'a')
the twentyfirst number as a character, /(Write 's')
/(5) the twentieth number as a character, /(Write 'e')
the fifteenth number as a character, /(Write ' ')
the sixteenth number as a character, /(Write '#')
the seventeenth number as a character, /(Write ':')
the cell indexed by the seventh number as a character, and /(Write the output character)
/(10) the fourth number as a character. /(Write '\n')
This code reads
/(Numeric I/O)
the seventh number as a character. /(Read a digit)
This code uses the sums
/(Numeric I/O)
of the first product and the second ordered difference, /(Sum to place in NIOVal)
of the cell indexed by the first number and the sixth number, /(Head of stack as ASCII)
/(Program)
of the first number and the third number, and /(Stack pointer plus one)
of the thirteenth number and the third number. /(Case index plus one)
This code uses
/(Numeric I/O)
the condition that the fifth number is less than the seventh number, /(The character read is >= '0')
the condition that the seventh number is less than the nineteenth number, /(The character read is <= '9')
the condition that the eighth number is equal to the second number, /(NIOVal is zero, i.e. we have pushed all its digits)
the condition that the cell indexed by the first number is equal to the fourth number, /(We have finished printing digits)
/(Program)
/(5) the condition that the cell indexed by the first number is equal to the nineth number, /(Return label for after_reading_case_count)
the condition that the cell indexed by the first number is equal to the tenth number, /(Return label for after_writing_case_number)
the condition that the thirteenth number is equal to the twelveth number, /(Have just done the last case)
the condition that the seventh number is equal to the fourth number, and /(Read '\n')
the condition that the seventh number is equal to the fifteenth number. /(Read ' ')
This code uses thirteen labels.
/(General)
/(The trampoline, jumps to a label based on the head of the stack)
/(Numeric I/O)
/(Numeric read into NIOVal)
/(Reading digits)
/(Numeric write from NIOVal)
/(5) /(Pushing digits)
/(Printing digits)
/(Program)
/(Return label for after_reading_case_count)
/(Return label for after_writing_case_number)
/(Top of the main loop)
/(10) /(Jump here on reading ' ')
/(Jump here on reading '\n')
/(End of program)
/(Inner loop)
This code uses the ordered differences
/(General)
between the first number and the third number, /(One less than the stack pointer)
/(Numeric I/O)
between the seventh number and the sixth number, /(The numeric value of the character read)
between the eighth number and the second product, and /(NIOVal % 10)
/(Program)
between the seventh number and the eleventh number. /(Index of char to print)
This code assigns
/(General)
the third sum to the first number, /(Increment the stack pointer)
the first ordered difference to the first number, /(Decrement the stack pointer)
/(Numeric I/O)
the second number to the eighth number, /(Clear NIOVal)
the first sum to the eighth number, /(Update NIOVal with the new digit)
/(5) the third ordered difference to the cell indexed by the first number, /(Put the last digit of NIOVal on the stack)
the fourth number to the cell indexed by the first number, /(Put a ten on the stack to mark the last digit)
the first ratio to the eighth number, /(Divide NIOVal by 10)
the second sum to the cell indexed by the first number, /(Convert the head of the stack to ASCII)
/(Program)
the nineth number to the cell indexed by the first number, /(Set return point to after_reading_case_count)
/(10) the tenth number to the cell indexed by the first number, /(Set return point to after_writing_case_number)
the eighth number to the twelveth number, /(Set the case count from NIOVal)
the third number to the thirteenth number, /(Init the case index)
the fourth sum to the thirteenth number, /(Increment the case index)
the thirteenth number to the eighth number, and /(Set NIOVal from the case index)
/(15) the fourth ordered difference to the seventh number. /(Decode)
This code uses the products
/(Numeric I/O)
of the eighth number and the fourth number, and /(NIOVal * 10)
of the first ratio and the fourth number. /(NIOVal / 10 * 10)
This code implements
/(Program)
the nineth assignment,
the second jump,
the seventh label,
the eleventh assignment,
the twelveth assignment,
the nineth label,
the second output,
the third output,
the fourth output,
the fifth output,
the sixth output,
the seventh output,
the tenth assignment,
the fourteenth assignment,
the fifth jump,
the eighth label,
the eighth output,
the sixth output,
the thirteenth label,
the first input,
the twelveth jump,
the eleventh jump,
the fifteenth assignment,
the nineth output,
the thirteenth jump,
the tenth label,
the sixth output,
the thirteenth jump,
the eleventh label,
the tenth output,
the tenth jump,
the thirteenth assignment,
the fourteenth jump,
/(Numeric I/O)
the second label,
the first input,
the third assignment,
the third jump,
the third label,
the fourth assignment,
the first input,
the fourth jump,
the first jump,
the fourth label,
the first assignment,
the sixth assignment,
the fifth label,
the first assignment,
the fifth assignment,
the seventh assignment,
the sixth jump,
the sixth label,
the eighth assignment,
the first output,
the second assignment,
the seventh jump,
the second assignment,
the first jump,
/(General)
the first label,
the eighth jump,
the nineth jump,
the tenth jump,
the eleventh jump, and
the twelveth label.
This code uses the ratio
/(Numeric I/O)
of the eighth number to the fourth number. /(NIOVal / 10)
This code uses the logical operations
/(Numeric I/O)
of not the first condition or not the second condition, /(The character read is not a digit)
of not the first logical operation or not the first logical operation, /(The character read is a digit)
of not the third condition or not the third condition, and /(NIOVal != 0)
of not the fourth condition or not the fourth condition. /(The head of the stack is 10, end of digits)
This code is cool.