View Code? Open in Web Editor
NEW
BrainFuck Compiler Challenge
Home Page: https://blog.steve.fi/writing_a_brainfuck_compiler_.html
License: GNU General Public License v2.0
Go 89.48%
Makefile 4.32%
Shell 6.20%
bfcc's Introduction
I've been programming for over half my life, I'm comfortable creating, developing, maintaining, and improving software written in C, C++, Emacs Lisp, Perl, Ruby, Java, Shell, TCL, etc.
Most of my new projects are written in Golang.
But also I've been writing code in Z80 assembly language, to run under CP/M and the humble ZX Spectrum 48k.
My interests primarily revolve around compilers, interpreters, domain-specific languages, and virtual machines.
Location: Helsinki, Finland.
Occupation: Sysadmin / Devops / Cloud-person.
bfcc's People
Contributors
bfcc's Issues
I read this earlier today:
There were some neat ideas about optimization, specifically trying to create opcodes/IR for "[-]
", etc. Rather than just interpreting token by token.
This might be worth exploring, though remember I will need to update three places:
In the past we generated C source file, and compiled via gcc.
Then we swithced to generating assembly language source, compiling via nasm.
We should allow both. Add a "backend" and let the user choose which to run.
Just means updating the assembly language.
At the moment bogus input will cause problems. We kinda assume things are well-formed, because we're very naive.
If we wanted to be robust we should implement a lexer/parser, and work on tokens. We could then add error-handling, proper test-cases, etc, etc.
This would make the code bigger.
It would allow us to support both C and Assembly language output though.
Not a huge priority, but I guess I could take a look at it in the near future.
Since we have plugabble back-ends it might be nice to have a simple interpreter implemented as one.
It kinda defeats the point of us being a compiler but it also demonstrates the speedup gained by actually compiling.