1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// for error messages
#include <iostream>
 
// for the brainfuck library
#include "Brainfuck.h"
 
// this include is for the GNU AS brainfuck library
#include "bf.gnu.as.cpp"
 
int main(int argc, char** argv)
{
       // if the filename to parse is not passed
       if (argc < 2)
       {
              // print usage details
              printf("Usage: %s [source]\n", argv[0]);
 
              // quit execution
              return EXIT_SUCCESS;
       };
 
       // parser object
       Brainfuck::Parser<30000> parser;
 
       // generate the assembly code using the GNU AS writeInstruction
       parser.parseFile(argv[1], GNU_AS::gen);
};