Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope is a stack of symbol tables.
func NewScope ¶
func NewScope() *Scope
NewScope creates a new symbole scope with one symbol table at the bottom.
func (*Scope) Declare ¶
Declare declares a symbole on the top of the symbol table stack. It returns nil on successful, and returns the conflict symbol when it is already declared.
func (*Scope) Pop ¶
Pop removes a symbol table from the top of the stack. It panics when the stack is empty after the pop.
func (*Scope) PushTable ¶
PushTable adds an existing table on the top of the stack.
type Symbol ¶
type Symbol struct { Type int Obj interface{} ObjType interface{} Pos *lexing.Pos Used bool // contains filtered or unexported fields }
Symbol is a data structure for saving a symbol.
func Make ¶
Make creates a new symbol
func (*Symbol) Clone ¶
Clone returns a clone of the symbol which item is the given one.
func (*Symbol) Name ¶
Name returns the symbol name. This name is immutable for its used for indexing in the tables.