Documentation ¶
Index ¶
- Constants
- type Bytecode
- type Compilable
- type CompilationScope
- type Compiler
- func (c *Compiler) AddConstant(o obj.Object) int
- func (c *Compiler) AddInstruction(ins []byte) int
- func (c *Compiler) Bookmark(pos int)
- func (c *Compiler) Bytecode() *Bytecode
- func (c *Compiler) Compile(node Compilable) error
- func (c *Compiler) Emit(opcode code.Opcode, operands ...int) int
- func (c *Compiler) EnterScope()
- func (c *Compiler) LastIs(op code.Opcode) bool
- func (c *Compiler) LeaveScope() (code.Instructions, []tauerr.Bookmark)
- func (c *Compiler) LoadSymbol(s Symbol) int
- func (c *Compiler) NewError(pos int, s string, a ...any) error
- func (c *Compiler) Pos() int
- func (c *Compiler) RemoveLast()
- func (c *Compiler) ReplaceBreakOperands(startBody, endBody, operand int) error
- func (c *Compiler) ReplaceContinueOperands(startBody, endBody, operand int) error
- func (c *Compiler) ReplaceLastPopWithReturn()
- func (c *Compiler) ReplaceOperand(opPos, operand int)
- func (c *Compiler) SetBytecode(b *Bytecode)
- func (c *Compiler) SetFileInfo(name, content string)
- func (c *Compiler) UnresolvedError(name string, pos int) error
- type EmittedInst
- type Symbol
- type SymbolScope
- type SymbolTable
Constants ¶
View Source
const ( GenericPlaceholder = 9999 ContinuePlaceholder = 9998 BreakPlaceholder = 9997 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bytecode ¶
type Compilable ¶
type CompilationScope ¶
type CompilationScope struct {
// contains filtered or unexported fields
}
type Compiler ¶
type Compiler struct { *SymbolTable // contains filtered or unexported fields }
func NewWithState ¶
func NewWithState(s *SymbolTable, constants *[]obj.Object) *Compiler
func (*Compiler) AddInstruction ¶
func (*Compiler) Compile ¶
func (c *Compiler) Compile(node Compilable) error
func (*Compiler) EnterScope ¶
func (c *Compiler) EnterScope()
func (*Compiler) LeaveScope ¶
func (c *Compiler) LeaveScope() (code.Instructions, []tauerr.Bookmark)
func (*Compiler) LoadSymbol ¶
func (*Compiler) RemoveLast ¶
func (c *Compiler) RemoveLast()
func (*Compiler) ReplaceBreakOperands ¶
func (*Compiler) ReplaceContinueOperands ¶
func (*Compiler) ReplaceLastPopWithReturn ¶
func (c *Compiler) ReplaceLastPopWithReturn()
func (*Compiler) ReplaceOperand ¶
func (*Compiler) SetBytecode ¶
func (*Compiler) SetFileInfo ¶ added in v1.5.0
type EmittedInst ¶
type Symbol ¶
type Symbol struct { Name string Scope SymbolScope Index int }
type SymbolScope ¶
type SymbolScope int
const ( GlobalScope SymbolScope = iota LocalScope BuiltinScope FreeScope FunctionScope )
type SymbolTable ¶
type SymbolTable struct { Store map[string]Symbol FreeSymbols []Symbol NumDefs int // contains filtered or unexported fields }
func NewEnclosedSymbolTable ¶
func NewEnclosedSymbolTable(outer *SymbolTable) *SymbolTable
func NewSymbolTable ¶
func NewSymbolTable() *SymbolTable
func (*SymbolTable) Define ¶
func (s *SymbolTable) Define(name string) Symbol
func (*SymbolTable) DefineBuiltin ¶
func (s *SymbolTable) DefineBuiltin(index int, name string) Symbol
func (*SymbolTable) DefineFree ¶
func (s *SymbolTable) DefineFree(original Symbol) Symbol
func (*SymbolTable) DefineFunctionName ¶
func (s *SymbolTable) DefineFunctionName(n string) Symbol
Click to show internal directories.
Click to hide internal directories.