Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giuseppe/gccbrainfuck
A Brainfuck frontend for GCC
https://github.com/giuseppe/gccbrainfuck
brainfuck c compiler frontend gcc
Last synced: 24 days ago
JSON representation
A Brainfuck frontend for GCC
- Host: GitHub
- URL: https://github.com/giuseppe/gccbrainfuck
- Owner: giuseppe
- License: gpl-3.0
- Created: 2013-02-17T03:14:49.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-01-14T22:39:33.000Z (almost 6 years ago)
- Last Synced: 2023-03-31T04:04:05.577Z (over 1 year ago)
- Topics: brainfuck, c, compiler, frontend, gcc
- Language: C
- Homepage:
- Size: 21.5 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: COPYING
Awesome Lists containing this project
README
# GCC Brainfuck
A GCC frontend for the brainfuck programming language.
## Compile the frontend
To compile the Brainfuck frontend, the GCC source code is needed in
addition to the Brainfuck frontend specific files:```
$ git clone https://github.com/giuseppe/gccbrainfuck.git
$ git clone --depth 1 git://gcc.gnu.org/git/gcc.git
$ ln -s $(pwd)/gccbrainfuck gcc/gcc/brainfuck
```Once the `gcc/brainfuck` directory is in place, we can compile GCC with
the brainfuck frontend enabled, the GCC build does not allow
`$buildir` to be the same as `$srcdir`, so we will do that in a
`build` subdirectory, even though it could be any other directory.
Compiling GCC can take quite a while, so you can enjoy a coffee while
you are waiting for it.```
$ mkdir gcc/build
$ cd gcc/build
$ ../configure --enable-languages=brainfuck --disable-multilib
$ make -j $(nproc)
```Install the files in `build/sysroot`
```
$ make install DESTDIR=sysroot
```## Compile a Brainfuck "Hello World" program
Now we can compile a simple program written in Brainfuck:
```
$ cat > /tmp/helloworld.bf <++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>
---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
EOF
$ PATH=$(pwd)/sysroot/usr/local/bin:$PATH gcc helloworld.bf -o helloworld
$ ./helloworld
Hello World!
```