Bracket - an esoteric programming language
Numbers
- 0 →
[] (equivalent to group of no statements)
- 1 →
[()]
- 2 →
[()()]
- 3 →
[()()()]
- ...
Operators
& (equivalent to +1)
* (equivalent to -1)
Variables/Functions
{x}()[y] - set value of variable x to y
{x}[] - get value of variable x
{x}(y)[z] - define function x with arguments y to return value z
{x}[y] - call function x with arguments y
- statements can be grouped using
[] (value of a group is the value of the last statement in it)
Conditionals
[x] | [y] | [z] - if x != 0 then y else z
Variable/Function Names
- Valid bracket nestings only, e.g.
(), (()), (()()), (()(())), etc.
Try-Catch
<try_block|catch_block> - if error is encountered while executing try_block, execution continues from catch_block instead.
Print
<x> - print x as a number
<x|> - print x as a character
- Value of the statement is the value of x