bruh():bruh() is an esolang by User:None1 and pronouced "bruh bruh", it uses only built-in functions and custom functions.
There are two types of functions: custom functions and built-in functions.
Each function is given a random unique ID from 0 to 264-1, every time the program is executed, the ID of the function is reset when it is defined, but won't change during the execution.
bruh():bruh() has only one type: Unbounded unsigned integer (when 0 is subtracted it stays 0), so when a function is passed as an argument to another function, its ID is passed instead.
To define a custom function, use the following syntax:
Function name and argument names can have any character except commas, parentheses, colons and line feeds. arguments are separated by commas.
When the function is called, it evaluates and returns the result of expression.
The name of function and the argument names cannot conflict with existing function names, otherwise a syntax error is raised.
All names in bruh():bruh() are case sensitive.
bruh() is indeed the most important custom function in bruh():bruh(), it is the entrypoint of a program, like the
main() function in C. bruh() must take no arguments, and its return value is ignored. A program may not have a bruh() function, but would do nothing without it. Note that bruh() supports recursion, so the program below works as an infinite loop.
There are these built-in functions:
|Function||What it does|
|in()||Read an integer from user input and return it|
|inc()||Read a character from user input and return its ASCII value|
|out(x)||Output x as decimal without trailing space or line feed and return x|
|outc(x)||Output the character with the same ASCII value as x and return x|
|div(a,b)||Return the quotient of a/b|
|mod(a,b)||Return the remainder of a/b|
|0()~9()||Return corresponding integer (0~9)|
|a()~f()||Return 10 to 15 respectively|
|if(a,b,c,params)||If a is nonzero, call the function with the ID b with arguments params, otherwise call the function with the ID c with arguments params, return return value of corresponding function. This is the only function that can be called with a mutable number of arguments|
EOF returns 0 in all input functions
Unlike other languages like Python and Java, bruh():bruh() needs a stack with infinite size, so the maximum number of recursion solely depends on your computer's memory.
Note that a function is only allowed to call functions defined before it, so the following program is invalid:
And this one is also invalid, because the ID of the
g function hasn't been created yet:
Line feeds are not ignored in this esolang, but spaces and tabs are. So the following program is invalid because of name conflict:
br uh():br uh() bruh():br uh()
; comments out all characters after it until the next line.
func():add(out(1()),func()) func2():out(0()) bruh():if(in(),func,func2)
It silently consumes memory until your computer dies.
n-th Fibonacci number
null(x,y,n):sub(y,x) fib(x,y,n):if(n,fib,null,y,add(x,y),sub(n,1)) bruh():out(fib(0,1,in()))
one(x):1() fac(x):mul(if(x,fac,one,sub(x,1)),x) bruh():out(fac(in()))