https://esolangs.org/wiki/tiny

Tiny is a small integer RPN based language created by User:Ron.hudson. It is a console/character type interpretive programming language, in which all statements are either assignments or those that print quoted strings.

    • WasPentaliveOP
      link
      2
      edit-2
      1 year ago

      You can do a loop by storing the “@” program counter in the stack, Performing the body and the check for exit, if exit then jump to next step after the loop, pop the “$” and store in “$” and “@” to return to the top of the loop. After the loop clean the stack by poping the stored top of loop address and discarding it.

      $ cat hiloop
      10 "Print a greeting 10 times \n" '%02d'
      20 [10] c
      30 [@] $ "top of loop will be the line after this one \n"
      40 [c] ? "  Hello World Greeting! \n"
      50 [c 1 -] c
      60 [c 0 = ! $ * ] $ @
      70 "Done \n\n"  [$]
      80 .
      
      $ tiny hiloop
      Print a greeting 10 times 
      top of loop will be the line after this one 
      10  Hello World Greeting! 
      09  Hello World Greeting! 
      08  Hello World Greeting! 
      07  Hello World Greeting! 
      06  Hello World Greeting! 
      05  Hello World Greeting! 
      04  Hello World Greeting! 
      03  Hello World Greeting! 
      02  Hello World Greeting! 
      01  Hello World Greeting! 
      Done 
      
      Explained:  
      10 print a header and set output format
      20 initialize counter
      30 Push the address of the next step (@) onto the stack ($) and print a line to mark the top of our loop.
      40 print the greeting with a helpful counter number
      50 decrement the counter
      60 if the counter has not reached zero go to the top of the loop, restoring the loop-top back to the stack
      70 if 60 falls thru we are done, clean up the stack by poping once.
      80 end of program sentinel
      

      I think it is much more expressive than BrainFuck.