Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FuncTypes = []any{ 1: new(func() time.Duration), 2: new(func() time.Month), 3: new(func() time.Time), 4: new(func() time.Weekday), 5: new(func() []uint8), 6: new(func() []interface{}), 7: new(func() bool), 8: new(func() uint8), 9: new(func() float64), 10: new(func() int), 11: new(func() int64), 12: new(func() interface{}), 13: new(func() map[string]interface{}), 14: new(func() int32), 15: new(func() string), 16: new(func() uint), 17: new(func() uint64), 18: new(func(time.Duration) time.Duration), 19: new(func(time.Duration) time.Time), 20: new(func(time.Time) time.Duration), 21: new(func(time.Time) bool), 22: new(func([]interface{}, string) string), 23: new(func([]string, string) string), 24: new(func(bool) bool), 25: new(func(bool) float64), 26: new(func(bool) int), 27: new(func(bool) string), 28: new(func(float64) bool), 29: new(func(float64) float64), 30: new(func(float64) int), 31: new(func(float64) string), 32: new(func(int) bool), 33: new(func(int) float64), 34: new(func(int) int), 35: new(func(int) string), 36: new(func(int, int) int), 37: new(func(int, int) string), 38: new(func(int64) time.Time), 39: new(func(string) []string), 40: new(func(string) bool), 41: new(func(string) float64), 42: new(func(string) int), 43: new(func(string) string), 44: new(func(string, uint8) int), 45: new(func(string, int) int), 46: new(func(string, int32) int), 47: new(func(string, string) bool), 48: new(func(string, string) string), 49: new(func(interface{}) bool), 50: new(func(interface{}) float64), 51: new(func(interface{}) int), 52: new(func(interface{}) string), 53: new(func(interface{}) interface{}), 54: new(func(interface{}) []interface{}), 55: new(func(interface{}) map[string]interface{}), 56: new(func([]interface{}) interface{}), 57: new(func([]interface{}) []interface{}), 58: new(func([]interface{}) map[string]interface{}), 59: new(func(interface{}, interface{}) bool), 60: new(func(interface{}, interface{}) string), 61: new(func(interface{}, interface{}) interface{}), 62: new(func(interface{}, interface{}) []interface{}), }
View Source
var MemoryBudget uint = 1e6
Functions ¶
Types ¶
type Opcode ¶
type Opcode byte
const ( OpInvalid Opcode = iota OpPush OpInt OpPop OpStore OpLoadVar OpLoadConst OpLoadField OpLoadFast OpLoadMethod OpLoadFunc OpLoadEnv OpFetch OpFetchField OpMethod OpTrue OpFalse OpNil OpNegate OpNot OpEqual OpEqualInt OpEqualString OpJump OpJumpIfTrue OpJumpIfFalse OpJumpIfNil OpJumpIfNotNil OpJumpIfEnd OpJumpBackward OpIn OpLess OpMore OpLessOrEqual OpMoreOrEqual OpAdd OpSubtract OpMultiply OpDivide OpModulo OpExponent OpRange OpMatches OpMatchesConst OpContains OpStartsWith OpEndsWith OpSlice OpCall OpCall0 OpCall1 OpCall2 OpCall3 OpCallN OpCallFast OpCallTyped OpCallBuiltin1 OpValidateArgs OpArray OpMap OpLen OpCast OpDeref OpIncrementIndex OpDecrementIndex OpIncrementCount OpGetIndex OpSetIndex OpGetCount OpGetLen OpGetGroupBy OpGetAcc OpPointer OpThrow OpGroupBy OpSetAcc OpBegin OpEnd // This opcode must be at the end of this list. )
type Program ¶
type Program struct { Bytecode []Opcode Arguments []int Constants []any // contains filtered or unexported fields }
Program represents a compiled expression.
func NewProgram ¶
func NewProgram( source *file.Source, node ast.Node, locations []file.Location, variables int, constants []any, bytecode []Opcode, arguments []int, functions []Function, debugInfo map[string]string, ) *Program
NewProgram returns a new Program. It's used by the compiler.
func (*Program) Disassemble ¶
Disassemble returns opcodes as a string.
func (*Program) DisassembleWriter ¶
DisassembleWriter takes a writer and writes opcodes to it.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.