ล่าม Brainfuck เขียนใน C.
brainfuck [-veh] file...
-e --eval run code directly
-v --version show version information
-h --help show a help message.
คอนโซลแบบโต้ตอบสามารถเข้าถึงได้โดยไม่มีการโต้แย้ง
นอกจากนี้เรายังมี C API:
#include <stdio.h>
#include <stdlib.h>
#include <brainfuck.h>
int main () {
BrainfuckState * state = brainfuck_state ();
BrainfuckExecutionContext * context = brainfuck_context ( BRAINFUCK_TAPE_SIZE );
BrainfuckInstruction * instruction = brainfuck_parse_string ( ",+++++." );
brainfuck_add ( state , instruction );
brainfuck_execute ( state -> root , context );
brainfuck_destroy_context ( context );
brainfuck_destroy_state ( state );
return EXIT_SUCCESS ;
}ตัวอย่าง/ ไดเรกทอรีมีโปรแกรมตัวอย่าง Brainfuck จำนวนมาก เราได้พยายามที่จะคุณลักษณะผู้เขียนดั้งเดิมของโปรแกรมเหล่านี้หากเป็นไปได้
ดาวน์โหลดซอร์สโค้ดโดยเรียกใช้รหัสต่อไปนี้ในพรอมต์คำสั่งของคุณ:
$ git clone https://github.com/fabianishere/brainfuck.gitหรือเพียงแค่หยิบสำเนาของซอร์สโค้ดเป็นไฟล์ซิป
สร้างไดเรกทอรี Build
$ mkdir build
$ cd buildBrainfuck ต้องการ CMake และคอมไพเลอร์ C (เช่น Clang หรือ GCC) เพื่อทำงาน นอกจากนี้ยังขึ้นอยู่กับ liabedit ซึ่งมีอยู่ในที่เก็บหลักของการแจกแจง Linux ส่วนใหญ่ (เช่น libedit-dev บน debian/ubuntu) และมาพร้อมกับเครื่องมือบรรทัดคำสั่ง MacOS XCode จากนั้นเพียงสร้าง makefiles:
$ cmake ..และในที่สุดก็สร้างมันโดยใช้ระบบอาคารที่คุณเลือก (เช่นทำ):
$ makeหลังจากสร้างเสร็จแล้วคุณสามารถติดตั้งไบนารีลงในระบบท้องถิ่นของคุณ (ดู CMAKE_INSTALL_PREFIX สำหรับข้อมูลเกี่ยวกับคำนำหน้าการติดตั้ง):
$ make installหรือคุณสามารถเรียกใช้ล่ามได้โดยตรงโดยไม่ต้องติดตั้งเช่น:
$ ./brainfuck ../examples/hello.bfรหัสถูกเผยแพร่ภายใต้ Apache License Version 2.0 ดู license.txt
Fabian Mastenbroek https://github.com/fabianishere
aliclubb https://github.com/aliclubb
diekmann https://github.com/diekmann
SevenBits https://github.com/SevenBits
Alex Burka https://github.com/durka
outis https://github.com/outis
rien333 https://github.com/rien333
boweiliu https://github.com/boweiliu
Rotartsi https://github.com/ROTARTSI82
Saket Upadhyay https://github.com/Saket-Upadhyay
outis https://github.com/outis
Jalmari91 https://github.com/Jalmari91
Alok Singh https://github.com/alok
Lasse Damsgaard Skaalum https://github.com/humleflue