Parsing works

This commit is contained in:
avinal
2020-08-18 19:00:05 +05:30
parent 65a303eec8
commit 4d7fcf04a2
2 changed files with 110 additions and 0 deletions

32
parser.hpp Normal file
View File

@@ -0,0 +1,32 @@
#include <tuple>
#include <vector>
#include <unordered_map>
#include <fstream>
#include "vutility.hpp"
enum c_type
{
C_ARITHMETIC,
C_PUSH,
C_POP,
C_LABEL,
C_GOTO,
C_IF,
C_FUNCTION,
C_RETURN,
C_CALL
};
typedef std::tuple<c_type, std::string, int> vmcommand;
class parser
{
private:
std::string input_file;
std::vector<vmcommand> parsed;
public:
parser(std::string file) : input_file(file) {}
std::vector<vmcommand> get_commands();
c_type command_type(std::string com);
void parse();
};