1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
#include "symbol-table.hpp"
#include "value.hpp"

namespace LambdaCalc {

void SymbolTable::define(const std::string& name, ValuePtr value) {
   table[name] = value;
}

ValuePtr SymbolTable::get(const std::string& name) const {
   Table::const_iterator it = table.find(name);
   if (it == table.end()) {
      return ValuePtr(nullptr);
   }
   return it->second;
}

// namespace LambdaCalc