Download Latest Version bfa.tar (61.4 kB)
Email in envelope

Get an email when there's a new version of Brainfuck Assembler

Home
Name Modified Size InfoDownloads / Week
Makefile 2013-02-19 247 Bytes
install.sh 2013-02-19 89 Bytes
lex.cc 2013-02-19 2.6 kB
main.cc 2013-02-19 694 Bytes
brainfuckassembler.h 2013-02-19 2.2 kB
brainfuckassembler.ih 2013-02-19 793 Bytes
brainfuckassemblerbase.h 2013-02-19 2.4 kB
brainfuckassembler.cc 2013-02-19 6.1 kB
grammar 2013-02-19 3.1 kB
parse.cc 2013-02-19 28.5 kB
bf2c.c 2013-02-19 1.3 kB
bfa.tar 2013-02-19 61.4 kB
example 2013-02-19 168 Bytes
README 2013-02-19 1.4 kB
Totals: 14 Items   110.9 kB 0
To install, make the install.sh script executable:
    $ chmod u+x install.sh
And run:
    $ ./install.sh
    
This should generate 2 executables:
- bfa
- bf2c

The first is the BrainFuck assembler, which can be used to translate
a readable source file (it is a made-up language for which I have no name
yet, you are welcome to contribute) into the BrainFuck Language.

The resulting BrainFuck-source can then be translated using the second 
executable: bf2c. This will generate a C-source file which can be compiled 
with a C-compiler of your choice.

The language of the input source supports the following (C-like) operators:
+  (addition)
-  (subtraction)
*  (multiplication)
/  (division) 
%  (modulus)
=  (assignment) 
+= (addition assignment)
-= (subtraction assignment)
*= (multiplication assignment)
/= (division assignment)
%= (modulus assignment)
Also, I/O is implemented using the 'print' and 'scan' operators. For example,
the statement 'print x' will print the value of 'x' to stdout and 'scan x' 
will read a value from stdin and store this in the variable 'x'.

The variables do not have to be declared before usage. On first use, a variable
is automatically allocated and initialized to 0. I have not implemented a 
deallocation function yet.

An example source-file is included to get you started.

./bfa example example.bf
./bf2c example.bf example.c
gcc example.c
./a.out

Happy BrainFucking!

jorenheit@gmail.com
Source: README, updated 2013-02-19