Bipoint

From Esolang
Jump to: navigation, search

Bipoint is an esoteric programming language created by User:FireFly 2009. It's an SMM with a very limiting set of operations.

Syntax

A Bipoint program consists of a series of node declarations, which looks like the following:

id : op -> ifZero : ifOne

where the spaces signify any amount of tabs or spaces (zero or more).

  • id is a positive number which identifies the node. The id of a node must be unique in a vaild Bipoint program.
  • op is an operation. Valid operations are S, 0 and 1.
  • ifZero is a number matching the id of a node (any node, including the same node as the row defines, is acceptable).

Execution

A program executes on a given stack of symbols, which are either 0 or 1. These are read from standard in, and pushed in the order they are read:

  • "10011" would mean that {1, 0, 0, 1, 1} would be pushed to the stack, so it would contain {1, 1, 0, 0, 1}.

After the input process, the program begins by jumping to the starting node. From there, it continues to the nodes given by ifZero and ifOne, by popping one number from the input stack and moving on accordingly. For every node after the starting node, the operations 0 and 1 each pushes their values to the output stack.

When the input stack is empty, program execution ends. At the end of execution, the output stack is popped until empty, and the number consisting of these binary digits is returned.

Example programs

Decrementing a number is quite trivial to do in Bipoint. Incrementing a number, on the other hand, would be impossible, since incrementing any number which only consists of 1 digits would mean the length of the resulting number would exceed the length of the number given as input.

Below is a program that decrements any number greater than 0:

1 : S -> 2 : 3
2 : 1 -> 2 : 3
3 : 0 -> 5 : 4
4 : 1 -> 4 : 5
5 : 0 -> 4 : 5

Computational class

Its exact computational class is unknown, but Bipoint is at most as powerful as finite state automata with output, since every Bipoint program is essentially the transition graph of one.