From Esolang
Jump to: navigation, search

A simple esoteric programming language.


Hopscotch programs are made of the commands +><^/\*?@_ and integer literals. The commands are chained linearly, but integer literals and the ? can cause the instruction pointer to jump.


Hopscotch has a stack of theoretically unlimited length. Additionally, it has a register. Each command is passed the value on the register, and the value it return is placed on a register. When the code jumps, the register may be affected. Hopscotch programs are executed according to an instruction pointer, which is incremented after each command, and can be further modified by certain commands.


All characters except +><^/\*?@_0123456789- are ignored. Each command is one token long. Each of +><^/\*?@_ is a token individually, and successive 0123456789- are grouped into a single token. This token is interpreted as a single integer. Sequences such as 123-456 are illegal, as `123-456` is not a single integer. Sequential integers must be separated with _ or another command. Code is executed one command at a time, beginning with the first command and terminating if the instruction pointer points beyond or before the code.


There are ten commands and integer literals in Hopscotch

Command Name Description
+ ADD Pops the top two items off the stack and then places the sum on the register.
> PUSH Takes the value on the register and pushes it on the stack, leaving it unchanged.
< POP Pops the top value on the stack and sets the register to it.
^ PEAK Reads the top value of the stack, without removing it, and places that value on the register.
/ OUT Writes the ascii character represented by the value on the register to std out, leaving the register unchanged.
\ IN reads one character from stdin and writes that value to the register
* MULT pops two values from the stack and sets the register to the product.
 ? IF If the value in the register is set to a non-zero number, then the instruction pointer is incremented by one (in addition to the normal one). Regardless, the register remains unchanged.
@ ROT Rotates the top _n_ values of the stack, where _n_ is the value in the register. That is, pops the _nth_ item on the stack, and pushes it to the top. The register remains unchanged
_ NOP No action is taken and the register is unchanged.

Integer Literals

An integer literal is a relative jump. The normal increment of one of the instruction pointer is replaced by an increment by the integer. If the token immediately before the destination of a jump is an integer literal, then the register is set to that value.

Computational Class

The creator believes that Hopscotch is Turing-Complete, as he believes that BrainF*ck can be implemented. There is no formal proof.

Helpful hints

To represent data, 3_nc works, where n is an integer literal to have the register set to it as command c is executed.

External Resources

[Spec and Work-In-Progress Implementation]