Documentation
¶
Overview ¶
Package comp implements a byte code generator targeting the vm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
type Compiler struct {
*goparser.Parser
vm.Code // produced code, to fill VM with
Data []vm.Value // produced data, will be at the bottom of VM stack
Entry int // offset in Code to start execution from
FuncRanges []vm.FuncRange // bytecode [Start, End) range for every compiled function, in source order
// contains filtered or unexported fields
}
Compiler represents the state of a compiler.
func NewCompiler ¶
NewCompiler returns a new compiler state for a given scanner.
func (*Compiler) BuildDebugInfo ¶
BuildDebugInfo constructs a DebugInfo from the compiler's symbol table and source registry. The result can be passed to DumpFrame/DumpCallStack.
func (*Compiler) Compile ¶
Compile parses src and generates code and data, or returns a non-nil error. Code and data are added incrementally in c.Code and C.Data.
func (*Compiler) MethodFuncTypes ¶ added in v0.2.0
MethodFuncTypes returns a slice of bound-method func types (no receiver) indexed by global method ID. Entries are nil when no interface declaration recorded the signature (e.g. methods on native types resolved purely via reflect).
func (*Compiler) MethodNames ¶
MethodNames returns the reverse mapping of global method IDs to names.