RinGy

From Esolang
Jump to navigation Jump to search

RinGy is an esoteric programming language created by User:FireFly in 2009. The memory is shared between program and data, and the memory could be represented as a circular linked list, where the key of the last element points to the first. Instructions are executed until the program halts. The standard file extension of a RinGy program is .ry.

Program flow

There is the circular memory (which may be represented by a linked list). There also exists an instruction pointer and a memory pointer.

At the start of execution, both IP and MP points to the first value of the memory. The code is read into the memory, consisting of exactly the same values.

One instruction at a time, the code in the memory is executed. Since the memory is formed as a loop, the program won't terminate until the 'q' instruction is executed, or an error occurs. This is also the only means of looping in RinGy.

Trying to execute any non-valid character is an error, and terminates the program (incorrectly).

Syntax

RinGy consists of single character instructions, just like Brainfuck, Befunge and many other esoteric programming languages. These instructions are:

Command Description
< Decreases memory pointer by 1.
> Increases memory pointer by 1.
'c Writes the ascii value of the character 'c' to the memory element MP currently points at.
+ Increases the value of the current memory element by 1.
- Decreases the value of the current memory element by 1.
_ Inserts a memory set to 0 at the location of MP, shifting all values after it to the right by 1.
:c Skips through the code until the next occurence of 'c', if the value at current memory cell isn't 0; continue reading after 'c'. (Else, continue reading after the first 'c'.)
. Print the character representing the value at the current memory cell.
, Print the numerical value at the current memory cell.
q Quit the program successfully.

'c' may be any character.

Example programs

Here follows some example programs written in RinGy.

Hello, world!

Prints the string "Hello, world!" followed by a newline, and exits successfully.

'H.'e.'l..'o.',.'!-.'w.'o.'r.'l.'d.'!._++++++++++.q

99 bottles of beer

'c:-d->>'!->'!-----------------------<<<:->'N.'o.>.<'m.'o.'r.'e.:-,>->.<'b.'o.
't..'l.'e.<-:<>:.<>'s.<+>>.<'o.'f.>.<'b.'e..'r.>.<'o.'n.>.<'t.'h.'e.>.<'w.'a.
'l..',.>.<<:->'n.'o.>.<'m.'o.'r.'e.:-,>->.<'b.'o.'t..'l.'e.<-:<>:.<>'s.<+>>.<
'o.'f.>.<'b.'e..'r.'..>>.<<<:q>'G.'o.>.<'t.'o.>.<'t.'h.'e.>.<'s.'t.'o.'r.'e.>
.<'a.'n.'d.>.<'b.'u.'y.>.<'s.'o.'m.'e.>.<'m.'o.'r.'e.',.>.<'9..>.<'b.'o.'t..'l
.'e.'s.>.<'o.'f.>.<'b.'e..'r.>.<'o.'n.>.<'t.'h.'e.>.<'w.'a.'l..'..>>.q>'T.'a.
'k.'e.>.<'o.'n.'e.>.<'d.'o.'w.'n.>.<'a.'n.'d.>.<'p.'a.'s..>.<'i.'t.>.<'a.'r.'o
.'u.'n.'d.',.>.<<:->'n.'o.>.<'m.'o.'r.'e.:-,>->.<'b.'o.'t..'l.'e.<-:<>:.<>'s.<
+>>.<'o.'f.>.<'b.'e..'r.>.<'o.'n.>.<'t.'h.'e.>.<'w.'a.'l..'..>>..<<<+:d

Computational class

The computational class is currently unknown.

Variations

The original RinGy didn't have the '<' instruction, but it was added as an aid to make more complex programs. However, the '<'-free RinGy may still be of interest when analysing the computational class, to see if it differs or not.

External resources