From Esolang
Jump to navigation Jump to search

TMCB is a functional programming language created by revcompgeek on April 26, 2008. TMCB stands for Too Many Curly Brackets due to the fact that it uses them for almost everything.


Statements in TMCB are enclosed by {} and are either function calls or expressions.


All function calls in TMCB are of the form {name}{params} where name is the name of the function to be called, and params is a semi-colon separated list of parameters to the function. Function definitions take the form {{name}{params}{code}}


All variable names are specified in the form {name}, where name is an identifier starting with anything except for "'{} and digits 0-9. If curly brackets are added to the end of a name, the value inside is used as an array subscript for strings. Example: The following are legal function/variable names

{Hello, World!}
{misleading array[2]}
{array subscript{{3}}}

And the following are illegal.

{95 blah}
{hi {}}
{= fjr 89}

Variable and functions may not have the same name.


All values must be included inside {}. Variable assignments are of the form {name}={value or name}, where value is either a number or a string enclosed in double or single quotes. {} are also used for enclosing parts of an expression. Valid operators are +-*/%^!&|<> Example: {{45}+{10}}/{5} should equal 11

Built-in functions

{} - a NOP function. Can be used to place comments in your code.
{add} - adds all of its parameters together.
{mul} - multiplies all of its parameters together
{print} - prints its parameters to stdout
{input num} - returns a number from stdin
{input char} - returns a char from stdin
{type} - returns 0 if type is function, 1 if type is number, 2 if type is string array
{char} - casts its parameters to chars and returns a char array
{int} - casts its parameter to an int
{exists} - returns a 1 if its parameter exists (must be a name), and a 0 if not
{while} - while its first parameter is true, evaluates the rest of its parameters in order
{break} - breaks out of a while loop
{if} - does its second parameter only if the first one is true
{else} - this must be placed immediately after an if's closing bracket, executes its parameter only if the attached if did not
{exit} - exits with its parameter as the return code (if it has one)


Here are just a few quick examples of how things are done.

Hello World

{{print}{{"Hello, World!"}}}

Cat program

Copies input to output until ASCII 26 (EOF)

{{c}={input char}{}}{{while}{{{c}!={26}};{print}{{c}};{{c}={input char}{}}}}