diff options
Diffstat (limited to 'asm/assembler.cpp')
-rw-r--r-- | asm/assembler.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/asm/assembler.cpp b/asm/assembler.cpp new file mode 100644 index 0000000..275bd4a --- /dev/null +++ b/asm/assembler.cpp @@ -0,0 +1,17 @@ +#include "assembler.h" + +std::unordered_map<std::string, FactoryFunction> ops; + +bool registerOp(const std::string& mnemonic, FactoryFunction f) +{ + if (ops.contains(mnemonic)) { + std::cout << "Warning: mnemonic |" << mnemonic << "| already registered." << std::endl; + return false; + } + + std::cout << "Registering mnemonic |" << mnemonic << "|." << std::endl; + + ops[mnemonic] = f; + + return true; +} |