mirror of
https://github.com/avinal/The-Hack-Assembler.git
synced 2026-01-10 07:08:32 +05:30
Minor changes
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <functional>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
#include "symbol_table.hpp"
|
||||||
|
|
||||||
class parser
|
class parser
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::string filename;
|
std::string filename;
|
||||||
int count_ins = 0;
|
symbol_table table;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
parser() {}
|
parser() {}
|
||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
void assemble();
|
void assemble();
|
||||||
std::vector<std::array<char, 16>> get_machine_code;
|
std::vector<std::array<char, 16>> get_machine_code;
|
||||||
char command_type(std::string mnemonic);
|
char command_type(std::string mnemonic);
|
||||||
std::string symbol();
|
void create_table();
|
||||||
std::string dest(std::string des);
|
std::string dest(std::string des);
|
||||||
std::string comp(std::string com);
|
std::string comp(std::string com);
|
||||||
std::string jump(std::string jum);
|
std::string jump(std::string jum);
|
||||||
|
|||||||
@@ -32,10 +32,11 @@ private:
|
|||||||
{"SCREEN", 16384},
|
{"SCREEN", 16384},
|
||||||
{"KBD", 24576},
|
{"KBD", 24576},
|
||||||
};
|
};
|
||||||
|
int next = 15;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
symbol_table() {}
|
symbol_table() {}
|
||||||
|
int available();
|
||||||
void add_entry(std::string symbol, int address);
|
void add_entry(std::string symbol, int address);
|
||||||
bool contains(std::string symbol);
|
bool contains(std::string symbol);
|
||||||
int get_address(std::string symbol);
|
int get_address(std::string symbol);
|
||||||
|
|||||||
Reference in New Issue
Block a user