mjplusplus  v0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
symbol_table.hpp
Go to the documentation of this file.
1 #ifndef SYMBOL_TABLE_HPP
2 #define SYMBOL_TABLE_HPP
3 
4 #include <stack>
5 #include "../../globals.hpp"
6 #include "Change.hpp"
7 #include "Scope.hpp"
8 #include "Definition.hpp"
9 #include "Symbol.hpp"
10 
11 namespace semantic
12 {
13  namespace symbol
14  {
16  {
17  private:
18  std::stack<shptr<Change>> changes;
19  shptr<Scope> currentScope;
20  public:
21  /*
22  * return definition of symbol
23  */
25  void insert(shptr<Symbol> symbol, shptr<Definition> def);
26  void enterScope();
27  void leaveScope();
28  bool definedInCurrentScope(shptr<Symbol> symbol) const;
29 
30  shptr<Scope> const& getCurrentScope() const;
31 
32  SymbolTable();
33  };
34  }
35 }
36 
37 #endif
bool definedInCurrentScope(shptr< Symbol > symbol) const
Definition: symbol_table.cpp:47
shptr< Scope > const & getCurrentScope() const
Definition: symbol_table.cpp:52
void leaveScope()
Definition: symbol_table.cpp:33
std::shared_ptr< T > shptr
Definition: globals.hpp:7
Definition: ClassMember.hpp:7
SymbolTable()
Definition: symbol_table.cpp:9
void insert(shptr< Symbol > symbol, shptr< Definition > def)
Definition: symbol_table.cpp:21
void enterScope()
Definition: symbol_table.cpp:28
Definition: symbol_table.hpp:15
shptr< Definition > lookup(shptr< Symbol > symbol) const
Definition: symbol_table.cpp:14