Turi ip ip ip

From Esolang
Jump to navigation Jump to search

Turi ip ip ip is a programming language inspired by the viral YouTube video Turi ip ip ip. Each character is pushed tring input is pushed to the stack at the beginning.

Instructions

   Numbers are represented like this:
   ip ip ip ip = 3
   ip ip, ip ip ip = 32
   ip ip, ip, tura ip ip = 20.1
   tura ip ip, ip ip ip ip, tura ip, ip ip = -13.01
   Comments are introduced [like this].
   Instructions are seperated by line or by semicolons.
   turi x - Push x to the stack.
   eugh x -x=1: add top two values
           x=2: subtract
           x=3: multiply
           x=4: divide
           x=5: negate
           x=10: modulo
           x=20: power
           x=30: print number
           x=40: print character
           x=50: get line on string input, push characters to stack backwards without newline
           x=100: dup
           x=200: swap
           x=300: convert stack from ascii to number (e.g. 49 50 51 -- 123)
           x=400: next stack
           x=1000: previous stack
           x=2000: push to backup stack
           x=3000: push from backup stack
  eugh eugh - While top of stack is not zero.
  turisha - End while.

Examples

Truth machine

eugh ip ip ip ip ip ip, ip                                      [get input]
turi ip ip ip ip ip, ip ip ip ip ip ip ip ip ip; eugh ip ip ip  [t=t-48]
eugh eugh; eugh ip ip, ip, ip; eugh ip ip ip ip, ip; turisha    [print '1' forever]
eugh ip ip ip ip, ip                                            [print '0']

Hello, World!

This program prints the message “Hello, World!” to the standard output:

turi ip ip ip ip ip ip ip ip, ip ip ip; eugh ip ip ip ip ip, ip
turi ip ip, ip, ip ip; eugh ip ip ip ip ip, ip
turi ip ip, ip, ip ip ip ip ip ip ip ip ip; eugh ip ip ip ip ip, ip
turi ip ip, ip, ip ip ip ip ip ip ip ip ip; eugh ip ip ip ip ip, ip
turi ip ip, ip ip, ip ip; eugh ip ip ip ip ip, ip
turi ip ip ip ip ip, ip ip ip ip ip; eugh ip ip ip ip ip, ip
turi ip ip ip ip, ip ip ip; eugh ip ip ip ip ip, ip
turi ip ip ip ip ip ip ip ip ip, ip ip ip ip ip ip ip ip; eugh ip ip ip ip ip, ip
turi ip ip, ip ip, ip ip; eugh ip ip ip ip ip, ip
turi ip ip, ip ip, ip ip ip ip ip; eugh ip ip ip ip ip, ip
turi ip ip, ip, ip ip ip ip ip ip ip ip ip; eugh ip ip ip ip ip, ip
turi ip ip, ip, ip; eugh ip ip ip ip ip, ip
turi ip ip ip ip, ip ip ip ip; eugh ip ip ip ip ip, ip

Cat program

A repeating line-based cat program is realized in the following, terminating only if receiving a completely empty line or the null character. The program utilizes several language facilities, including the concatenation of adjacent ASCII codes into a single integer number, the while loop facility, and the backup stack.

[Push 0 for both repeatingly printing the input line inwith the     ]
[inner 'eugh eugh' loop, and ascertaining that, for an empty input, ]
[the outer 'eugh eugh' does not query an empty stack.               ]
turi ip
[Query for the first input line.]
eugh ip ip ip ip ip ip, ip
[Repeat until no input, or a single 'null character', has been      ]
[committed.                                                         ]
eugh eugh
  [Print all characters of the most recent input line.]
  eugh eugh
    eugh ip ip ip ip ip, ip
  turisha
  [Query for the next input line.]
  eugh ip ip ip ip ip ip, ip
turisha

Looping counter

This program queries the user for the number of iterations to produce, printing during each cycle a tally of asterisks (“*”) tantamount to the current counter value on a line of its own:

[Query for a numeric user input: The tally of repetitions N.]
eugh ip ip ip ip ip ip, ip
[Convert user input N into integer number.]
eugh ip ip ip ip, ip, ip
[Push initial counter value, zero (0), to backup stack.]
turi ip
eugh ip ip ip, ip, ip, ip
eugh eugh
  [Decrement repetition count N by one.]
  turi ip ip
  eugh ip ip ip
  [Copy counter value from backup stack.]
  eugh ip ip ip ip, ip, ip, ip
  [Increment counter value by one.]
  turi ip ip
  eugh ip ip
  [Duplicate copied counter value.]
  eugh ip ip, ip, ip
  [Push one copy of the counter back to the backup stack.]
  eugh ip ip ip, ip, ip, ip
  [Print the counter value as a catena of asterisks ('*').]
  eugh eugh
    [Push the ASCII code of the symbol '*' (= 42) unto the stack and print it.]
    turi ip ip ip ip ip, ip ip ip
    eugh ip ip ip ip ip, ip
    [Decrement the counter value for the next iteration.]
    turi ip ip
    eugh ip ip ip
  turisha
  [Remove the zero-valued top element by adding it to the repetition count.]
  eugh ip ip
  [Push the ASCII code of a newline (= 10) unto the stack and print it.]
  turi ip ip, ip
  eugh ip ip ip ip ip, ip
turisha

Interpreter

  • Common Lisp implementation of the Turi ip ip ip programming language.