一个愚蠢的答复。

brainfoose的Python项目详细描述


一个愚蠢的答复。

安装

PYPI(推荐):

sudo pip3 install brainfoose

使用git master手动安装:

git clone https://github.com/abactel/brainfoose

cd brainfoose

pip install -r requirements.txt

sudo setup.py install

用法

用法:

brainfoose [--run_command=<programs>]

brainfoose [--tape_size=<tape_size>]

brainfoose [--verify_program=<tape_size>]

brainfoose (-h | --help)

brainfoose --version

选项:
-h, --helpShow this message
--versionShow version information
--runRun a command without starting a REPL
--tape_size=<tape_size>
Set size of tape [default: 3000]

语言的语法如下:

TokenMeaning
^{tt11}$Print a help screen
^{tt12}$Increment the data pointer by 1.
^{tt13}$Decrement the data pointer by 1.
^{tt14}$Increment the value at the data pointer by 1.
^{tt15}$Decrement the value at the data pointer by 1.
^{tt16}$Output the byte at the data pointer. The byte is formatted to the character it represents.
^{tt17}$Store a value at the data pointer’s position. The character is as a decimal byte representing the character. The character is accepted form a standard input prompt.
^{tt18}$If the value at the data pointer is 0, move to matching ^{tt19}$.
^{tt19}$If the value at the data pointer is not 0, move to matching ^{tt18}$.
^{tt22}$Display tape up to last non-zero cell.
^{tt23}$Reset tape.
^{tt24}$Load program from file, syntax: ^{tt25}$.

Brainfuck上的维基百科页面包括以下教程:

[ This program prints "Hello World!" and a newline to the screen, its
  length is 106 active command characters. [It is not the shortest.]

  This loop is an "initial comment loop", a simple way of adding a comment
  to a BF program such that you don't have to worry about any command
  characters. Any ".", ",", "+", "-", "<" and ">" characters are simply
  ignored, the "[" and "]" characters just have to be balanced. This
  loop and the commands it contains are ignored because the current cell
  defaults to a value of 0; the 0 value causes this loop to be skipped.
]
++++++++               Set Cell #0 to 8
[
    >++++               Add 4 to Cell #1; this will always set Cell #1 to 4
    [                   as the cell will be cleared by the loop
        >++             Add 2 to Cell #2
        >+++            Add 3 to Cell #3
        >+++            Add 3 to Cell #4
        >+              Add 1 to Cell #5
        <<<<-           Decrement the loop counter in Cell #1
    ]                   Loop till Cell #1 is zero; number of iterations is 4
    >+                  Add 1 to Cell #2
    >+                  Add 1 to Cell #3
    >-                  Subtract 1 from Cell #4
    >>+                 Add 1 to Cell #6
    [<]                 Move back to the first zero cell you find; this will
                        be Cell #1 which was cleared by the previous loop
    <-                  Decrement the loop Counter in Cell #0
]                       Loop till Cell #0 is zero; number of iterations is 8

The result of this is:
Cell No :   0   1   2   3   4s

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么加载个人密钥库需要这么多时间?   当我使用main创建Android应用程序UI时,如何通过java修改它。xml文件?   java Tomcat 6和7:WebappClassLoader:尝试为名称org/apache/openjpa/persistence/osgi/BundleUtils复制类定义   java`parseInt()`和`parseDouble()`throw`NumberFormatExeption`   JavaSpringMongoDB填充引用   在LinuxMint中打开Eclipse时发生java错误;OpenJDK 64位服务器VM警告:忽略选项MaxPermSize=512m;支持在8.0中被删除   使用PKCS7Padding的AES CBC加密在Java和Objective中有不同的结果   java为什么Jackson要用一个以类命名的额外层来包装我的对象?   json在Java中使用parallelStream提取值   JavaSpring存储库自动生成方法:按给定的顶部编号+按字段描述排序选择   java是否有可序列化的标准闭包接口?   .NET与Java在初创公司的web应用程序开发   如何修复java。java中的lang.unsatifiedLinkError   JavaFX+Spring Boot+Hibernate应用程序对多个环境的java支持   自定义视图组中的java更改未呈现