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.
18 lines
437 B
18 lines
437 B
// 极简符号表:记录局部变量定义点。
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
#include "SysYParser.h"
|
|
|
|
class SymbolTable {
|
|
public:
|
|
void Add(const std::string& name, SysYParser::VarDeclContext* decl);
|
|
bool Contains(const std::string& name) const;
|
|
SysYParser::VarDeclContext* Lookup(const std::string& name) const;
|
|
|
|
private:
|
|
std::unordered_map<std::string, SysYParser::VarDeclContext*> table_;
|
|
};
|