Cork

From Esolang
Jump to: navigation, search

Cork is a programming language written by User:Imaginer1 drawing inspiration from Brainfuck and the Wang B-machine. Example programs include the adder ,>,<->>+<<!4>->+<!12>. and the multiplier ,>,<->->+>+<<!6>>-<<+>>!16<<<!4>>.

Characters

Character Command
> Move pointer right
< Move pointer left
+ Increment tape
- Decrement tape
 ![n] If the current cell is nonzero, jump to the nth instruction
. Output the current cell as a number
a Output the current cell as an ASCII character
, Prompt the user for numerical input and set tape under pointer to this value.
i Prompt the user for an ASCII character and set tape under pointer to this value.

Commands are numbered 0, 1, 2... etc. For example, the program

,!0>+<

has its commands numbered as , being the zeroth command, !0 being the first command, > being the second command, and so on. The !0 indicates a jump to the zeroth command, the initial one in the program. Furthermore, the final ! in the program

,>,<->>+<<!4>->+<!12>

does not indicate a jump to command 1, but a jump to command 12.

External resources