One of my favorite esoteric programming languages is .Box (pronounced "dot box"). It was created in 2009 by Esolangs user Fr34k and E. Grouse. What amazes me about .Box is that it operates using only dots (.) and linefeed, but it allows for complex functional programming language constructs to evolve from its binary code.
Here is a list of commands. Most of them have been changed to be more consistent with others in their indicator group. In addition, I added some new commands to make the language work with more types of data than just numbers.
The general order of instructions is
start using variables
command
variable name
value
stop using variablesValue is optional. It is not a number of dots, rather, it is obtained by either getting the value of another variable, a reference to another variable, evaluating an arithmetic/boolean expression, or creating a number. If it is not provided, it is assumed to be null. The following are the commands, with the order corresponding to the number of dots:
Here are the commands in this indicator block:
This is the outline of function definitions:
Function Indicator
Define
function name
Start Parameters
list of variable blocks...
End Parameters
list of statements...
Closing Function IndicatorThe function name is a sequence of dots. This namespace is exclusive of the variable namespace, so they can share names. The body of a function is just a list of other indicator blocks.
To call a function, do the following:
Function Indicator
Call
function name
Start Parameters
list of blocks returning argument values...
End Parameters
Closing Function IndicatorTo define an anonymous function, just start with the parameter definitions:
Function Indicator
Start Parameters
list of variable blocks...
End Parameters
list of statements...
Closing Function IndicatorThe built-in functions provide flow control to the rest of the code. The general order of instructions is
start using built-in
command
condition
statements...
stop using built-inStatements can be any number of other indicator blocks. The rest of this block until the stop indicator is reached will be the body of the control structure. The condition should be a boolean expression.
Here are the built-ins:
Break and Label are special commands. They don't follow the structure of the other control flow commands. The Label command is followed by a sequence of dots identifying the loop that comes after it. The Break command is found inside loop bodies and is followed by a sequence of dots identifying which outer loop to break out of. If no parameter is provided to Break, then the immediate surrounding loop is stopped.
The number of dots between the start and end indicators will produce that number. If the dots are split among several even lines, then each line will represent one digit of the number. For example, the following are equivalent:
start using numbers
23 dots
stop using numbersand
start using numbers
2 dots
3 dotswill both produce 23.
Rather than having indicators on odd-numbered lines and commands on even-numbered lines, a shorthand syntax is being introduced. The odd/even rule is being thrown out. Instead, blocks will be defined by arrows < and >. Here's an example:
<. . ..... <...... .>>This defines a variable (named by 5 dots) whose value is the number 1.