Brainmaker

Brainmaker is a Brainfuck-based language-describer made by User:TehZ.
== Commands ==
Brainmaker has the following commands:
 > Go to next cell
 < Go to previous cell
 + Add one to current cell
 - Subtract one from current cell
 . Output current cell as ASCII character
 , Replace current cell with a read ASCII character
 [...] Two jump points surrounding some code
 ! Jump to matching ] (so this command skips other jump points until it reaches the end of the current "loop")
 & Jump to previous [
 ? Skip next command if the current cell isn't zero
But you can't use these commands directly, because Brainmaker is about making languages, not directly programming. So instead of using these commands directly, you use them to create new commands. The syntax for creating a new command is this:
 CMD : CODE
For example, say we want ) to execute two >'s. To do that, we write this:
 ) : >>
The commands available for programs written in the language defined by the programs made in Brainmaker are only the commands directly written as above. If you want to make the standard commands available, you have to make them yourself:
 > : >
 < : <
 + : +
(and so on)
However, there is a problem: with this system, it is not possible to define the [ and ] commands, because they are defined together, and therefore need to be together. The solution to this problem is this: There is another syntax for defining commands that take parameters:
 (PARAMETERS) CMD_THAT_USES_PARAMETERS : CODE
For example, a simple Brainmaker loop is defined as this:
 (CODE) [CODE] : [CODE]
Basically, the usual commands only allow single-character names, so it's easy for the compiler to find out which kind it is. If you want it to take multiple parameters, you simply have to write this:
 (COND, THEN) (COND|THEN) : COND[?!THEN]
(that was an if-then command)
If there is ambiguity, ie. both (, | and ) have already been defined, the behavior is undefined, with the recommended behavior being a compilation error.
== Overloading ==
You can use the commands you've made to create new commands. That might create some ambiguity, so to fix that, the default commands have higher precedence. Not only that, but to avoid circles, you are not allowed to access a command that you have defined before or at the definition point. If you want to access an overloaded command (a command with same name as the default commands, but with some other code), you have to prefix it with a '. If you want to access ', you have to write ''. (Two 's, not an ")
== Comments ==
You can add line-comments by putting to //'s at the end of the line. If you already have defined a command that can get confused with them, you can only add line comments on empty lines.
== Examples ==
A simple stack-based language:
> : > // push a new zero
(CODE) [CODE] : [?!CODE&] // brainfuck-style loop
< : '[-]< // pop and discard top element
% : '[->+>+<<]>>'[-<<+>>]< // duplicate top element
@ : '[->+<]<'[->+<]>>'[-<<+>>]< // swap top two elements
+ : '[-<+>]< // pop y, pop x, push x+y
- : '[-<->]< // pop y, pop x, push x-y
* : <'[->>+<<]>'[->'[->+<<<+>>]>'[-<+>]<<]>'[-]<
 // pop y, pop x, push x*y
. : .'[-]< // pop top char and output it
, : >, // push a char from input
0 : >++++++++++*
1 : 0+ // any digit d: pop x, push 10*x+d
2 : 1+ // thus the code >n where n is decimal
3 : 2+ // pushes the number n to the stack
4 : 3+
5 : 4+
6 : 5+
7 : 6+
8 : 7+
9 : 8+
This is an encoding of Brainfuck:
 > : > //Standard brainfuck operators
 < : <
 + : +
 - : -
 (CODE) [CODE] : [?!CODE&]
 . : .
 , : ,
== Power ==
I don't think that this language has the power to encode every language. However, I do think that it has the power to encode most languages with a SINGLE difference: you add an extra character at the end of the code. Basically, the first part tells the compiler what the program is, while the SINGLE difference is just so it has an interpreter. In other words, you make ONE command do the interpreting, while all the other commands set up the code. With that system, all language that have the right number of symbols can be encoded.
The language itself isn't turing-complete. However, it is meta turing-complete. That is, it can describe at least one turing-complete language.
== Alphabet ==
The alphabet of this language is compiler-dependent, but it must at least include UTF-8.
== Interpreters ==
Currently, no one has even bothered looking into how to make an interpreter, so this are none. If you are less lazy than the other people reading this article, please make an interpreter, because I am too lazy.
Moon (talk) 19:16, 6 May 2016 (UTC) Moon is in the progress of making one
Category:Meta-languages
Category:Brainfuck derivatives
Category:2011
Category:Languages