Build the compiler
$ c++ -o bfc bfc.cpp
Compile a brainfuck program (exampleexample) to C
$ ./bfc ascii.bf
Compile the resulting C program to an executable.
$ cc -g -O0 -o ascii ascii.bf.c
Run the executable natively.
$ ./ascii
Or, you can also run it in a debugger. As long as you compiled with debugging symbols included and without optimizations, you should be able to step through the brainfuck source code line by line.
$ gdb ascii [...] (gdb) break ascii.bf:1 Breakpoint 1 at 0x1000010fc: file ascii.bf, line 1. (gdb) run [...] Breakpoint 1, main (argc=1, argv=0x7fff5fbffbd0) at ascii2.bf:1 1 [-][ (gdb) break ascii.bf:66 Breakpoint 2 at 0x1000031c3: file ascii.bf, line 66. (gdb) cont Continuing. Breakpoint 2, main (argc=1, argv=0x7fff5fbffbd0) at ascii.bf:66 66 >>>>> >>>>> >>> . (c_ascii) (gdb) display m.ptr 1: m.ptr = 4 Current language: auto; currently minimal (gdb) display /d m.mem[0] @ 32 2: /d m.mem[0] @ 32 = {0, 58, 32, 10, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 58, 48, 1, 0, 0, 0, 58, 48, 1, 0, 0, 0, 58, 48, 0, 0} (gdb) display /d m.mem[m.ptr] 3: /d m.mem[m.ptr] = 0