Brainfuck
CGI Scripts
There are four main options that you have to use Brainfuck
programs in your CGI bin.
- Make your program executable and use it directly.
- Compile your program into machine language.
- Convert your program into another scripting language.
- Embed your program into another scripting language.
- Use mod_bf if you have an Apache webserver.
Make your program executable and use it directly
Please refer to my
article on how this is done.
There is a working example here with full source code available.
Compile your program into machine language
This is quite easy, you can use a translator
to convert your program into a compilable language, such
as C, and use the compiled program in your CGI bin, or
you could use a Brainfuck to machine language converter
to create an executable program directly.
See the Brainfuck
tools page for
a program that will convert Brainfuck
code into a C program which
can be compiled and then used. There is a working example
here with both the original Brainfuck and C
source code available.
Convert your program into another scripting language
You can use one of many available tools
which translate Brainfuck into one one of many ommon scripting
languages available, these include Perl, PHP, Java, JavaScript
and ASP; and
then use the converted program directly. One such program, bf2perl,
available on the Brainfuck tools page which
will convert Brainfuck code into a Perl script. There is
a working example with
both the original Brainfuck and Perl
source code available.
Embed your program into another scripting language
This is again quite easy, there are many
Brainfuck interpreters written in common scripting languages
available, these include Perl, PHP, Java, JavaScript and
ASP. To use these you would embed your program within the
interpreter depending on the usage instructions of the
interpreter.
Use mod_bf if you have an Apache webserver
Examples using mod_bf may be added at a later date.
|