forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
451 B
21 lines
451 B
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
#include "sem/Sema.h"
|
|
|
|
class SymbolTable {
|
|
public:
|
|
void EnterScope();
|
|
void ExitScope();
|
|
|
|
bool Declare(const std::string& name, const SymbolInfo* symbol);
|
|
const SymbolInfo* Lookup(const std::string& name) const;
|
|
const SymbolInfo* LookupCurrent(const std::string& name) const;
|
|
|
|
private:
|
|
std::vector<std::unordered_map<std::string, const SymbolInfo*>> scopes_;
|
|
};
|