a branflakes interpreter i used to play with c++
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
608 B

#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "brainfuck.hpp"
#include "error.hpp"
#include "lex.hpp"
std::string getFile(std::string filename) {
std::ifstream file{filename.c_str()};
std::stringstream ss;
ss << file.rdbuf();
return ss.str();
}
int main(int argc, char* argv[]) {
std::vector<std::string> args{argv + 1, argv + argc};
if (args.size() == 0) {
return 1;
}
Lexer lex{getFile(args[0])};
std::vector<OpCode> v = lex.lexCode();
Interpreter intr{v};
intr.run();
return 0;
}