mirror of
https://github.com/avinal/The-Hack-Assembler.git
synced 2026-01-11 15:48:31 +05:30
not implemented yet
This commit is contained in:
@@ -1 +1,22 @@
|
||||
#include "../include/symbol_table.hpp"
|
||||
#include "../include/symbol_table.hpp"
|
||||
|
||||
void symbol_table::add_entry(std::string symbol, int address)
|
||||
{
|
||||
symbols.insert(std::make_pair(symbol, address));
|
||||
}
|
||||
|
||||
bool symbol_table::contains(std::string symbol)
|
||||
{
|
||||
return !(symbols.find(symbol) == symbols.end());
|
||||
}
|
||||
|
||||
int symbol_table::get_address(std::string symbol)
|
||||
{
|
||||
if (contains(symbol))
|
||||
{
|
||||
return symbols[symbol];
|
||||
}else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user