102 lines
1.8 KiB
YAML
102 lines
1.8 KiB
YAML
id: "brainf"
|
|
aliases:
|
|
- "brainfuck"
|
|
- "bf"
|
|
name: "Brainf***"
|
|
|
|
info:
|
|
impl: "Beef"
|
|
year: 1993
|
|
desc: "Famous esoteric programming language created in 1993 by Urban Müller"
|
|
ext:
|
|
- b
|
|
- bf
|
|
web:
|
|
wiki: "https://en.wikipedia.org/wiki/Brainfuck"
|
|
esolang: "https://esolangs.org/wiki/Brainfuck"
|
|
impl: "https://kiyuko.org/software/beef"
|
|
source: "https://github.com/andreabolognani/beef"
|
|
category: esoteric
|
|
mode: interpreted
|
|
platform: bf
|
|
syntax: golf
|
|
typing: integer
|
|
paradigm: turing
|
|
usage: []
|
|
|
|
install:
|
|
apt:
|
|
- beef
|
|
scripts:
|
|
brainf: |
|
|
#!/usr/bin/env python3
|
|
import argparse
|
|
import readline
|
|
import subprocess
|
|
import tempfile
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("file", nargs="?")
|
|
args = parser.parse_args()
|
|
|
|
if args.file:
|
|
subprocess.run(["beef", args.file])
|
|
while True:
|
|
try:
|
|
code = input("bf> ")
|
|
except KeyboardInterrupt:
|
|
print("^C")
|
|
continue
|
|
except EOFError:
|
|
print("^D")
|
|
break
|
|
if not code:
|
|
continue
|
|
with tempfile.NamedTemporaryFile(mode="w") as f:
|
|
f.write(code)
|
|
f.flush()
|
|
subprocess.run(["beef", f.name])
|
|
|
|
repl: |
|
|
brainf
|
|
input: |
|
|
>++>+[>++++[-<++++>]<<]> [>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<
|
|
output: |
|
|
86
|
|
|
|
main: "main.bf"
|
|
template: |
|
|
++++++++
|
|
[
|
|
>++++
|
|
[
|
|
>++
|
|
>+++
|
|
>+++
|
|
>+
|
|
<<<<-
|
|
]
|
|
>+
|
|
>+
|
|
>-
|
|
>>+
|
|
[<]
|
|
|
|
<-
|
|
]
|
|
|
|
>>.
|
|
>---.
|
|
+++++++..+++.
|
|
>>.
|
|
<-.
|
|
<.
|
|
+++.------.--------.
|
|
>>+.
|
|
>++.
|
|
|
|
run: |
|
|
brainf main.bf
|
|
hello: |
|
|
Hello World
|