Who needs another Brainfuck compiler or interpreter? Nobody. Who wrote another one just for the kicks? Me. What was I trying to accomplish? Nothing, just learn and gain more hours of C coding.
yeti is a Brainfuck compiler and interpreter written in C and part of a learning activity. I chose this language as it is very well-known and simplistic in its design. The basis for what I've applied on this compiler comes from a series of posts by Austin Z. Henley in his series "Let's make a Teeny Tiny compiler" (you can start with part 1 here).
This code is in no sense good nor should be taken seriously as it is just for educational purposes. I'm planning on adding more features and fixes in the near future, though, but will not spend more energy and time on it than that.
The build it is very simple:
yeti » make gcc -Wall -pedantic -O2 -g -c emit.c -o emit.o gcc -Wall -pedantic -O2 -g -c interpreter.c -o interpreter.o gcc -Wall -pedantic -O2 -g -c lexer.c -o lexer.o gcc -Wall -pedantic -O2 -g -c parser.c -o parser.o gcc -Wall -pedantic -O2 -g yeti.c -o yeti *.o ( cd test/ && make 'CC=gcc' 'CFLAGS=-Wall -pedantic -O2 -g ' all ) gcc -Wall -pedantic -O2 -g -I../ -g test_emitter.c -o test_emitter ../*.o gcc -Wall -pedantic -O2 -g -I../ -g test_interpreter.c -o test_interpreter ../*.o gcc -Wall -pedantic -O2 -g -I../ -g test_lexer.c -o test_lexer ../*.o gcc -Wall -pedantic -O2 -g -I../ -g test_parser.c -o test_parser ../*.o
And the usage too:
yeti » ./yeti -i test/helloworld.bf Hello World! yeti »