|
NAMEebfc - ELF Brainfuck compilerSYNOPSISebfc [OPTIONS] SRCFILEDESCRIPTIONebfc is a compiler for the Brainfuck programming language, creating 64-bit ELF files targeted for the Intel x86-64 architecture.ebfc can create standalone executables, shared libraries, or object files. Object files can themselves be targeted for a standalone executable, a shared library, or a module in a larger program. COMPILATION TARGET OPTIONSThe following options control what type of source file is created. It is assumed here that the name of the source file is foo.b.
If the SRCFILE argument lacks a .b or .bf suffix, then the entire filename will be used when creating the name of the target file and function. (In the case of -x, the name of the target file will be a.out instead.) OTHER OPTIONS
LINKINGWhen calling a compiled Brainfuck program from within a C program, the C prototype for the function should have the form:extern void foo(void); or, if the --arg option is specified: extern void foo(char *buffer); In the latter case, the buffer pointed to by the function parameter will be used as the initial state of the Brainfuck buffer when the function is invoked, and upon return will contain the final state of the buffer. THE BRAINFUCK PROGRAMMING LANGUAGEA Brainfuck program has an implicit byte pointer, called "the pointer", which is free to move around within an array of bytes, initially all set to zero. The pointer itself is initialized to point to the beginning of this array. (The size of the array is not constrained by the language, but is typically 30000 bytes or more. ebfc programs are given an array of 32768 bytes.)The Brainfuck programming language consists of eight commands, each of which is represented as a single character.
Any other characters in the source code are treated as comments or whitespace, and ignored. The semantics of the Brainfuck commands can also be succinctly expressed in terms of C, as follows (assuming that p has been previously defined as a char*):
As with C, the generated program's behavior is undefined if the pointer is moved outside of the byte array. COMPRESSED BRAINFUCKThere is a compressed format for storing and transmitting Brainfuck programs, which ebfc can read natively by using the --compressed option.In compressed Brainfuck, the eight commands are encoded in three bits as follows:
Each byte in a compressed Brainfuck file contains one or more commands. The top two bits select between one of four possible readings of the lower six bits, as follows:
ERRORSThe compiler will issue an error message, and the compilation will fail, if the program contains unbalanced bracket commands, or if the level of nested brackets exceeds the compiler's maximum capacity (which is arbitrarily set at 256).COPYRIGHTCopyright © 1999, 2001, 2021 Brian Raiter <breadbox@muppetlabs.com>.License GPLv2+: GNU GPL version 2 or later. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Visit the GSP FreeBSD Man Page Interface. |