Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
EBFC(1)			    General Commands Manual		       EBFC(1)

NAME
       ebfc - ELF Brainfuck compiler

SYNOPSIS
       ebfc [-lxcszhv] [-f FUNCTION] [-o FILE] [-i FILE] SRCFILE

DESCRIPTION
       ebfc  is	 a  compiler  for the Brainfuck	programming language, creating
       32-bit ELF files	targeted for the Linux platform	running	under an Intel
       x86 architecture.

       ebfc  can  create  standalone  executables, shared libraries, or	object
       files, and the object file can itself be	targeted for a standalone exe-
       cutable or a shared library, as well as a simple	module.

COMPILATION OPTIONS
       The  following  options	control	how the	source file is compiled. It is
       assumed here that the name of the source	file is	foo.b.

       -x     Compile the source code into a standalone	executable file, named
	      foo.

       -l     Compile  the  source  code  into	a  function, named foo(), in a
	      shared library file, named libfoo.so.

       -c     Compile the source code into a function, named foo(), in an  ob-
	      ject file, named foo.o.

       -xc    Compile  the  source code	into an	object file, named foo.o, that
	      can then be linked into a	standalone executable.

       -lc    Compile the source code into a function, named foo(), in an  ob-
	      ject  file,  named  foo.o, that can then be linked into a	shared
	      library.

       If the source filename lacks a .b 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
       -f FUNCTION
	      Use FUNCTION as the name of the function to contain the compiled
	      program.	(This  option  is  not generally useful	when the final
	      target is	a standalone executable.)

       -o FILE
	      Use FILE as the target filename.

       -i FILE
	      Use FILE as the name of the source file to place in  the	target
	      file.  This option is only meaningful if the target is an	object
	      file, and	if the -s option is not	used.

       -s     Suppress inclusion of unnecessary	data in	the  target  file.  By
	      default,	ebfc includes a	.comment section in object and library
	      files, and includes the source filename in the .symtab  section.
	      These  items will	be removed from	the output when	this option is
	      used.

       -h     Display help and exit.

       -v     Display version number and exit.

       -z     Read the source file in compressed Brainfuck format.

LINKING
       When calling a compiled Brainfuck program from within a C program,  the
       C prototype for the Brainfuck function should have the form:

	   extern void foo(void);

THE BRAINFUCK PROGRAMMING LANGUAGE
       A Brainfuck program has an implicit byte	pointer, called	"the pointer",
       which is	free to	move around within an array of 30000 bytes,  initially
       all  set	to zero. The pointer itself is initialized to point to the be-
       ginning of this array.

       The Brainfuck programming language consists of eight commands, each  of
       which is	represented as a single	character.

       >   Increment the pointer.
       <   Decrement the pointer.
       +   Increment the byte at the pointer.
       -   Decrement the byte at the pointer.
       .   Output the byte at the pointer.
       ,   Input a byte	and store it in	the byte at the	pointer.
       [   Jump	to the matching	] if the byte at the pointer is	zero.
       ]   Jump	to the matching	[.

       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  ex-
       pressed	in terms of C, as follows (assuming that p has been previously
       defined as a char*):

       >   becomes  ++p;
       <   becomes  --p;
       .   becomes  putchar(*p);
       ,   becomes  *p = getchar();
       [   becomes  while (*p) {
       ]   becomes  }

COMPRESSED BRAINFUCK
       Chris Pressey introduced	a compressed format for	storing	and  transmit-
       ting  Brainfuck	programs, which	ebfc can read natively by using	the -z
       option.

       In compressed Brainfuck,	the eight commands are encoded in  three  bits
       as follows:

       +   000
       -   001
       <   010
       >   011
       [   100
       ]   101
       ,   110
       .   111

       Each  byte  in a	compressed Brainfuck file can contain two or more com-
       mands. The top two bits select between one of four possible readings of
       the lower six bits, as follows:

       Encoding	   Bits	       Translation
       singleton   00 abc abc  abc
       pair	   00 abc def  abc followed by def
       triplet	   10 ab cd ef 0ab then	0cd then 0ef
       repetition  01 abc def  def repeated 2 +	abc times (2-9)
       repetition  01 abcd ef  0ef repeated 2 +	abcd times (2-17)

ERRORS
       The  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).

       The program's behavior is subsequently  undefined  if  the  pointer  is
       moved outside of	the 30000-byte array.

COPYRIGHT
       Copyright (C) 1999 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.

ELF kickers 2.0			   July	1999			       EBFC(1)

NAME | SYNOPSIS | DESCRIPTION | COMPILATION OPTIONS | OTHER OPTIONS | LINKING | THE BRAINFUCK PROGRAMMING LANGUAGE | COMPRESSED BRAINFUCK | ERRORS | COPYRIGHT

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=ebfc&sektion=1&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help