User:DavidKendal/Unindexed

From Esolang
Jump to navigation Jump to search

Unindexed is a programming language based around the concept of a stack of 3" by 5" index cards. Anything can be written on these cards, and the contents can be shown upon the screen. The top card in this stack is always the current one.

Here is "Hello world!" in Unindexed:

new
Hello world!
show

Instructions

new Add a new index card to the stack and put it on top.
show Show the contents of the card on the screen.
input Take a line of input from the user and write it to the current index card.
scrap Scrap the index card completely.
next Move to the next index card in the stack. Put the current one on the bottom.
prev Move to the previous card in the stack. Take it off the bottom of the stack.
index n Give this card an index-number of n.
goto Jumps to the previous (nested) or next (un-nested) come-from statement, if the content of the current index card is true (i.e., it is not blank or equal to 0)
comefrom The matching statement to open a loop or conditional repeat.

In addition to these instructions, anything else which is found is written on the card on top, replacing anything already written on it. If an equation is found, such as 2+2, 5-2, 5*6 or 6/3, then it should be worked out and the result added to the stack instead. Other cards can be referenced in such cases by adding a # in front of the number, e.g. to reference the card whose index is set to 65, use #65.

The escape character for if you actually want to write a hash in front of a number, or actually want to write an equation to a card, is \. If you want to write "3+4" on the card, use 3\+4. If you want to write that to a card, use 3\\+4, etc. The same applies to index-references: \#64, \\#64, etc.

Turing-complete?

Hopefully.

Some example programs

Multiply two numbers together

new
input
index 1
new
input
index 2
new
#1 * #2
show