summaryrefslogtreecommitdiffhomepage
path: root/asm/assembler.cpp
blob: 275bd4af118b562a26369325a8dabe06169f151e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}