Minimalbf
Designed by | User:Yes |
---|---|
Appeared in | 2022 |
Dimensions | one-dimensional |
Computational class | Push-down automaton |
Major implementations | #Interpreter |
File extension(s) | .mbf .minimal .minibf .txt (These file types are only suggestions) |
Minimalbf is a esoteric programming language made by User:Yes in 2022. It is their fourth esolang they have made (and shared), it was inspired by brainfuck, and was made for the purpose of a language sharing properties with brainfuck, yet minimalistic limiting the language.
Language Overview
Due to Minimalbf's minimalism, it is limited in multiple ways. It has 6 commands, and does not allow for any user input, causing programs output to always remain the same. Most regular brainfuck programs that do not require user input will likely function, however it is unclear if Minimalbf was intended for characters that are not valid commands to be fully ignored. If that is the case, most regular programs still won't produce the desired output due to the absence of loops, and the alternate method of switching cells Minimalbf uses, which also requires cells to be cleared (value reset to 0) to move back cells. Only programs that use solely the commands +-.
will work cross Minimalbf and brainfuck.
Commands
Command | Purpose |
---|---|
+ | Increment |
- | Decrement |
. | Print ascii char |
0 | Clear cell |
/ | If 0 then back 1 cell otherwise go forward 1 cell |
? | If 0 then skip next instruction |
Interpreter
Written in Python 3.
code = input("> ") tape = [0] i = 0 while i < len(code): if code[i] == "+": tape[-1] += 1 elif code[i] == "-": tape[-1] -= 1 elif code[i] == ".": try: print(end=chr(tape[-1])) except ValueError: print("Error: The number", tape[-1], "cannot be converted to a character") break elif code[i] == "0": tape[-1] = 0 elif code[i] == "/": if tape[-1] == 0: tape.pop() if len(tape) == 0: print("Error: Cell pointer is negative") break else: tape.append(0) elif code[i] == "?": if tape[-1] == 0: i += 1 i += 1
Examples
Hello, World!
This Hello World program was made by the designer himself!
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.0+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.0++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.0++++++++++++++++++++++++++++++++++++++++++++.0++++++++++++++++++++++++++++++++.0+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.0+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++.0++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.--------.0+++++++++++++++++++++++++++++++++.0