Canon/Canon.Core/SemanticParser/SymbolTableEntry.cs
Lan_G ccd1899739 feat: symbol-table & type checker (#14)
Reviewed-on: PostGuard/Canon#14
Co-authored-by: Lan_G <2911328695@qq.com>
Co-committed-by: Lan_G <2911328695@qq.com>
2024-03-16 11:05:38 +08:00

38 lines
780 B
C#

namespace Canon.Core.SemanticParser;
/// <summary>
/// 符号表表项类
/// </summary>
public class SymbolTableEntry
{
public string Name;
public IdentifierType Type;
public bool IsConst; //是否为常量
public bool IsVarParam; //是否为引用变量
public SymbolTable? SubTable; //当前表项的子表
public SymbolTableEntry(string name, IdentifierType type, bool isConst, bool isVarParam)
{
Name = name;
Type = type;
IsConst = isConst;
IsVarParam = isVarParam;
}
public SymbolTableEntry(string name, IdentifierType type, SymbolTable subTable)
{
Name = name;
Type = type;
IsConst = false;
IsVarParam = false;
SubTable = subTable;
}
}