package scope type SymbolID struct { symbolKind SymbolKind scopeID ScopeID indexInScope int } func (id SymbolID) SymbolKind() SymbolKind { return id.symbolKind } type SymbolKind int const ( // A variable symbol is bound to a local on the stack. SymbolKindVariable SymbolKind = iota ) func (s SymbolKind) String() string { switch s { case SymbolKindVariable: return "variable" default: panic("unknown symbol kind") } } type Symbol[D SymbolData] struct { name string data D } func (s Symbol[D]) Data() D { return s.data } type SymbolData interface { SymbolVariable } type SymbolVariable struct { localIndex int } func (sv SymbolVariable) LocalIndex() int { return sv.localIndex }