41 lines
1.0 KiB
C++
41 lines
1.0 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 Test");
|
|
interpret_bf_test(tokenizer);
|
|
BLT_END_INTERVAL("Interpreters", "Tokens Test");
|
|
|
|
BLT_PRINT_PROFILE("Interpreters");
|
|
|
|
//interpret_bf(program);
|
|
|
|
return 0;
|
|
} |