bl-compiler

compiler for the bl programming language.
Log | Files | Refs | README

scope.hpp (560B)


      1 #pragma once
      2 
      3 #include <string>
      4 #include <memory>
      5 
      6 class Scope {
      7 public:
      8     explicit Scope(std::string name, int level, *Scope parent);
      9     std::string getScopeName();
     10     int getScopeLevel();
     11     *Scope getParentScope();
     12     void define(Symbol symbol);
     13     *Symbol lookup(std::string name);
     14     bool isDeclared(std::string name);
     15     std::unordered_map<std::string, Symbol> getAllSymbols();
     16     std::string toString();
     17 
     18 private:
     19     std::string scope_name;
     20     int scope_level
     21     *Scope parent_scope;
     22     std::unordered_map<std::string, Symbol> symbols;
     23 };