Revaver Language

last modified: March 19, 2009

In this ReversibleProgrammingLanguage, each command is the reverse of itself. If you run the program forward with 1 input, and then run that output through the program running in reverse order, then you will be back with the input it started with! Interpreter URL: http://zzo38computer.cjb.net/esoteric/revaver


It always starts at the line label TERMINATE (.). There can only be 1 of these in the whole program. The TELEPORT (*) command is the only way to jump to another place in the program. The PUSHPOP (;) command pops the top stack value if it is same as it's given parameter, otherwise, it pushes that value.


Example:

*.
.
<
_1
;1
<
*.

Long Text Example:

TELEPORT TERM
TERMINATE
SWAP
SUBTRACT 1
PUSHPOP 1
SWAP
TELEPORT TERM

This example in reverse:

TELEPORT TERM
SWAP
PUSHPOP 1
SUBTRACT 1
SWAP
TERMINATE
TELEPORT TERM

Copying number to other stack example:

SWAP
PUSHPOP #
SWAP

And at the end to remove where it used to be (otherwise it would be both places):

PUSHPOP #

'Some spelling and grammar issues fixed above -- PhilCooper


How would one compute the value of a non one-to-one function (such as "sin x" or "floor x") in such a language?

Some possibilities; none seems attractive:

Here is 1 more way:

In fact, that last one would be the standard definition of reversible computing, would it not? By definition, you can't throw away information, the best you can do is to make a distinction using some identity; the same way that it might be useful to multiply something by x/x, we do something with 'floor(x) - floor(x)'. -- WilliamUnderwood


What are the commands in this language?


CategoryProgrammingLanguage


Loading...