Brain_Fuck/src/main.cpp

45 lines
1.2 KiB
C++

#include <iostream>
#include <cstring>
#include <fstream>
#include <sstream>
#include <blt/std/loader.h>
#include <bf_mips_codegen.h>
#include <bf_interpreter.h>
#include <blt/profiling/profiler_v2.h>
#include "blt/std/format.h"
int main(int argc, const char** argv)
{
std::string file{"../mandelbrot.bf"};
if (argc > 1)
file = argv[1];
auto program = blt::fs::loadBrainFuckFile(file);
std::ofstream out{"../mips2.asm"};
bf_tokenizer tokenizer(program);
codegen(tokenizer, out);
BLT_START_INTERVAL("Interpreters", "Basic");
//interpret_bf(program);
BLT_END_INTERVAL("Interpreters", "Basic");
BLT_START_INTERVAL("Interpreters", "Tokens");
interpret_bf(tokenizer);
BLT_END_INTERVAL("Interpreters", "Tokens");
BLT_START_INTERVAL("Interpreters", "Tokens Dynamic Dispatch");
interpret_bf_dynamic(tokenizer);
BLT_END_INTERVAL("Interpreters", "Tokens Dynamic Dispatch");
BLT_START_INTERVAL("Interpreters", "Tokens Matching");
interpret_bf_matching(tokenizer);
BLT_END_INTERVAL("Interpreters", "Tokens Matching");
BLT_PRINT_PROFILE("Interpreters");
//interpret_bf(program);
return 0;
}