Brainfoop
Paradigm(s) | Imperative, object-oriented. |
---|---|
Designed by | 2000gmod |
Appeared in | 2021 |
Memory system | Tape-based |
Dimensions | 1D |
Computational class | Turing complete |
Reference implementation | Unimplemented |
Influenced by | Brainfuck |
File extension(s) | .bfoop , .bf |
Brainfoop (also known as BrainFOOP, BrainfOOP, Brain-Foop, BFOOP or simply Brainfoop) is a variant of Brainfuck that implements object-oriented programming (OOP) to Brainfuck. It was designed by 2000gmod in May of 2021.
THIS LANGUAGE IS STILL BEING DESIGNED.
Programming in Brainfoop
Brainfoop aims to extend the Brainfuck language into a more usable and abstract form, incorporating elements from C and C++. Brainfoop has the same operators as Brainfuck, but includes some additional ones, such as context declaration, context switching and halting.
Brainfoop is not a superset of Brainfuck, as Brainfoop requires symbols to declare comments inside code.
Programming in Brainfoop occurs in 4 different levels:
- Global
- Class
- Instance
- Method
Memory
Brainfoop extends the memory system of Brainfuck, it provides 4 levels of memory (called contexts). Code can only be executed inside the Global or Method contexts.
Operators
Operator | Description | Contexts |
---|---|---|
> |
Moves cell pointer to the right. | All |
< |
Moves cell pointer to the left. | All |
+ |
Increments pointer by 1. | Global, Method |
- |
Decrements pointer by 1. | Global, Method |
[ |
Jumps past the matching ] if pointer contains 0. |
Global, Method |
] |
Jumps back to the matching [ if pointer contains nonzero. |
Global, Method |
. |
Outputs the current cell as ASCII. | All |
, |
Inputs the ASCII number to the current cell. | Global, Method |
/ |
Stops execution of code of current context. | Global, Method |
# |
Stops execution of program in any context. | Global, Method |
Operator | Description |
---|---|
:<CONTEXT>{...} |
Declares new element in context. |
;<CONTEXT>{...} |
Navigates to selected context |
Example programs
Hello World
:class { :method { ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.> ---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++ } } ;class {.} /* Creates instance of the first class in class space. */ ;instance {.} /* Enters the first instance inside the instance space. */ ;method {.} /* Enters the first method of the first instance. */