mirror of
https://github.com/avinal/The-Hack-Assembler.git
synced 2026-01-10 23:28:33 +05:30
not implemented yet
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#ifdef SYMBOL_TABLE_HPP
|
||||
#ifndef SYMBOL_TABLE_HPP
|
||||
#define SYMBOL_TABLE_HPP
|
||||
|
||||
#include <unordered_map>
|
||||
@@ -7,11 +7,34 @@
|
||||
class symbol_table
|
||||
{
|
||||
private:
|
||||
std::unordered_map<std::string, int> symbols;
|
||||
std::unordered_map<std::string, int> symbols = {
|
||||
{"R0", 0},
|
||||
{"R1", 1},
|
||||
{"R2", 2},
|
||||
{"R3", 3},
|
||||
{"R4", 4},
|
||||
{"R5", 5},
|
||||
{"R6", 6},
|
||||
{"R7", 7},
|
||||
{"R8", 8},
|
||||
{"R9", 9},
|
||||
{"R10", 10},
|
||||
{"R11", 11},
|
||||
{"R12", 12},
|
||||
{"R13", 13},
|
||||
{"R14", 14},
|
||||
{"R15", 15},
|
||||
{"SP", 0},
|
||||
{"LCL", 1},
|
||||
{"ARG", 2},
|
||||
{"THIS", 3},
|
||||
{"THAT", 4},
|
||||
{"SCREEN", 16384},
|
||||
{"KBD", 24576},
|
||||
};
|
||||
|
||||
public:
|
||||
symbol_table();
|
||||
~symbol_table();
|
||||
symbol_table() {}
|
||||
|
||||
void add_entry(std::string symbol, int address);
|
||||
bool contains(std::string symbol);
|
||||
|
||||
Reference in New Issue
Block a user