Talk:Bipoint

From Esolang
Jump to navigation Jump to search

Example program: decrementing a number

I believe there is a problem with the example program.

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

If the input number is 10011 (19), the output should be 10010 (18). However the input stack starts at [1, 1, 0, 0, 1] and here is the result:

1 : S ->  2 :<3>     in: [1, 1, 0, 0, 1]    out: [             ]
3 : 0 ->  5 :<4>     in: [   1, 0, 0, 1]    out: [            0]
4 : 1 -> <4>: 5      in: [      0, 0, 1]    out: [         1, 0]
4 : 1 -> <4>: 5      in: [         0, 1]    out: [      1, 1, 0]
4 : 1 ->  4 :<5>     in: [            1]    out: [   1, 1, 1, 0]
5 : 0 ->  4 : 5      in: [             ]    out: [0, 1, 1, 1, 0]
input stack is empty: execution halts.

Thus the output number is 01110 (14). If I understand everything correctly, a correct decrement program would be exactly the same, but with 3 : 0 -> 4 : 5 instead of 5 : 4; lines 4 and 5 are supposed to perform "identity", so line 4 should never be called on a 0 and line 5 should never be called on a 1.

Incrementing is not as troublesome as you say it is; it just has to be done modulo the limitation in size imposed by the input. With a program similar to the decrementing one, it's easy to correctly increment any number that contains at least one 0; if the input is made only of 1s, then the output would be 0. That's how most programming languages do it, anyway.

On a totally unrelated matter, the wiki page is not explicit as to what S does; I'm guessing it's supposed to mark the starting line, but you could also take the convention that the starting line is defined by the id 1, or that it is the first line in the program. In that case, S would simply be a no-op, which may add some possibilities to the language?

--Koen (talk) 18:36, 24 September 2012 (UTC)

Computational class

Isn't this language precisely the set of finite automata over the alphabet {0,1}? Or more specifically, Moore transducers where both input and output alphabets are {0,1}. The stacks only serve to reverse input and output, which makes things no more complicated (if L is a regular language then rev(L) is regular too, ISTR.) (I'm also assuming S really does indicate the start state, and does not do some interesting and undescribed thing.) Chris Pressey (talk) 18:49, 26 September 2012 (UTC)

Hm okay. --Ørjan (talk) 21:00, 26 September 2012 (UTC)