Brainfuck++: Making a useless language do more uselessly!
The idea behind Brainfuck++ is to extend the Brainfuck language so that is can be used in more applications. By adding file I/O and networking support, the designer of Brainfuck++ (BF++) hopes that BF++ can be a more useful and more widely used language. While still a 'joke' language, it will be a more full featured 'joke' language.
The existing commands from Brainfuck all all the same, BF++ only adds to Brainfuck, so it is possible to write a plain Brainfuck program and run it as a BF++ one with no problems. The new commands are as follows:
- "#" - Opens a file for reading and writing (call again to close the file).
- ";" - Writes the ASCII character at the current cell to the file (overwrites any existing text).
- ":" - Reads a character from the file, and puts the value of ASCII character in the cell and advances the file pointer.
- "%" - Opens a socket for reading and writing (call again to close the socket).
- "^" - Sends the ASCII character at the current cell.
- "!" - Reads a character from the socket and places it's ASCII value in the current cell.
Thanks to Jason Rush (AkSnowman) BF++ now has a more detailed specification which can be found on the spec page! BF++ also has a Git repository which can be found on GitHub.
Currently, I'm working on making a Java to C meta compiler. So far it can handle standard BF syntax. Support for the file I/O has been added. I'm still working on it, and will add networking once I get the file bit working better. The Java program creates a C source file, and calls gcc to compile it. It says the file was created, whether or not it really worked. You can download the Java .class and .java files here. This requires GCC and Java.
I got the file I/O to work now, and I made a little program that works. It's very tender, so treat it nice :). I'm going to make some optimizations that will speed up and reduce source filesize before I
move on to the networking (will be harder). I'm also going to write up a more formal guide to some of the quirks (such as a newline handling). I have updated the Java files and they can be downloaded from above.
I made a small change so that when the file reader reaches the EOF, it returns a 0, this makes it easy to read a file from a loop. I also started work on the guide, which I have uploaded here. The link above has the new version of the Java class and source.