Toadskin

From Esolang
Jump to navigation Jump to search

Toadskin is a minimal esoteric programming language based on combining aspects of brainfuck and Forth.

One of the features brainfuck lacks is the ability to group commands together into blocks, functions, or procedures that can be reused. pbrain solves this by adding procedures. Toadskin solves this by adding a Forth-like ability to define sequences, or "words" in Forth terminology. Toadskin also replaces brainfuck's array of memory cells, or tape, with a stack, like Forth. Toadskin keeps six of the eight identical to brainfuck commands, but modifies the remaining two BF commands to work with a stack.

Commands

Cmd Description
+ BF increment
- BF decrement
[ BF Jump past matching ] if zero
] BF Jump to matching [
. BF output
, BF input
> modified to push stack
< modified to pop stack
: start sequence
; end sequence
% swap top 2 stack items

Words

In order to define a new reusable sequence, say to increment a cell five times, in Toadskin:

:V+++++;

The colon defines the start of the sequence. A character, 'V' in this example, is the sequence's name. The semicolon ends the sequence.

Each time V is seen in a command stream, five increments are executed:

:V+++++;V--V+++

This will result in 11.

External resources