mbf is a modified implementation of the esoteric programming language Brainfuck, with the addition of macros.
mbf is an acronym that stands for "Macro Brainfuck".
# hello_world.mbf
# hello macro
hello {
> 8+ [< 9+ > -] < .
> 4+ [< 7+ > -] > +.
7+ . .
3+ .
>> 6+ [< 7+ >-] < ++.
12- .
> 6+ [< 9+ >-] < + .
<.
3+ .
6- .
8- .
>>> 4+ [< 8+ >-] <+ .
}
# call hello
hello;% # use `mbf -h` for help
% mbf ./hello_world.mbf
Hello, World!
% mbf -E expanded.bf hello_world.mbf
[SUCCESS] file was successfully written!
% cat expanded.bf
>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<++.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-]<+.
% # see `examples/` for more examples-
Macros
-
Strict superset of BF
-
100% compatible with ordinary BF
-
Includes an interpreter to execute both MBF & BF code
-
Error messages
-
Supports comments
-
Macros can call other macros
-
Infinite cycle detection (see
examples/cycle.mbf) -
Lets you save expanded BF code with
-Eflag -
Helpful
-h/--helpflag for help
-
Clone this repository into
mbf/andcdinto it:% git clone --recursive https://github.com/vs-123/mbf.git % ls ./ ../ mbf/ % cd mbf/
-
Create a
build/directory andcdinto it:% mkdir -p build % cd build % ls ./ ../ -
Use CMake to generate buildsystem files and then build the project:
% cmake .. % cmake --build . -
You may now use the generated binary
% ls ./ ../ mbf* compile_commands.json
-
Use
maketo build the project:% pwd ~/mbf % make build [INFO] building... [SUCCESS] successfully built! % ls build/ && cd $_ ./ ../ mbf* % ./mbf ../examples/hello_world.mbf Hello, World!
-
Use
make testto run tests: (optional)% make test [INFO] building tests... [INFO] running tests... -
To perform a clean operation, use
make clean:% make clean [INFO] cleaning... [SUCCESS] cleaned successfully!
This program is licensed under the GNU Affero General Public License version 3.0 or later.
NO WARRANTY PROVIDED
For full terms, see LICENSE file or visit https://www.gnu.org/licenses/agpl-3.0.html.