Natsubf Brainfuck Runner and Debugger

Natsubf Brainfuck运行与调试工具


About Brainfuck

For users outside China, please read https://esolangs.org/wiki/Brainfuck. This is the full document of Brainfuck.
Here are some of my brainfuck programs.

对于中国用户,Esolang不太好使,就在这里简单说明一下了。
Brainfuck运行时会开一个大小为30000的byte数组,同时有一个指针,初始的时候指着位置0,有8种标识符:
+ 将当前指针指向的位置加1
- 将当前指针指向的位置减1
< 将指针左移一格(出界会报错)
> 将指针右移一格(出界会报错)
, 读入一个字符,并将这个字符的ASCII码存储到当前指针指向的位置
. 输出当前指针指向位置的ASCII码对应的字符
[ 若当前指针指向位置的值不为0,开始循环
] 若当前指针指向位置的值为0,则结束循环,否则回到对应的 [ 位置。
Brainfuck并不是一个正经的编程语言,但是由于brainfuck奇特的语法,可以将其看成是一个训练智商的工具。
这里是我的一些brainfuck程序,里面有比较详细的注释。


What's Natsubf

If you want to only RUN brainfuck programs, Natsubf is not nessesary. But if you want to make some large brainfuck programs, you can't avoid debugging, then natsubf is your best choice.
There is a Command Line UI debugger inside natsubf. In this debugger, you can make breakpoints, run to breakpoints and watch the memory (see the picture below). 如果你只需要运行brainfuck程序,那么你并不需要一个Natsubf,但是在编写大型brainfuck程序的时候,难免会遇到要调试的情况,此时Natsubf就是你最好的选择。
Natsubf内置一个终端用户界面调试器,在那里,你可以添加断点、运行到断点并且查看内存(见上图)。

Of course, there are more functions inside Natsubf. It not only contains a runner and debugger, but also contains a interactor. If you want to test something, you can use the interactor. You can reset the state and try again easily if the test is failed.
当然,Natsubf中除了运行和调试以外还有更多功能。它内置了一个交互程序,当你想要测试一段代码是否能够正常运行的时候,你可以用交互程序。而如果测试失败,也不必担心,你可以轻松地将状态复位,然后进行下一次测试。

For some large brainfuck programs, you can also use natsubf's optimize function. It can optimize a large program to a small program and execute in a faster speed. Natsubf also has a compile function. It can compile the source code to an executable file, or to a source code of other languages (such as C++).
对于一些大型brainfuck程序,你可以用natsubf中的优化功能。它可以将一个大型的程序优化成一个较小的程序,并且以更快的速度运行。Natsubf还有一个编译的功能,它能将brainfuck源代码编译成可执行文件,或者编译成其他语言的源代码(如C++)。


See the repo and download releases

This program supports to run in Windows and macOS. Please download the zip and extract ALL files in it to a PATH folder (like C:\Users\System32 in Windows and /usr/local/bin in macOS). Then type 'natsubf' in the terminal to read the usage.
程序有Windows版本和macOS版本,请下载对应版本后,将压缩包中所有的文件放置到一个PATH文件夹中(如Windows中的C:\Users\System32和macOS中的/usr/local/bin),然后在终端中输入“natsubf”查看使用说明。