Documentation
¶
Index ¶
- Constants
- func AppendAccess(filed string, loc Location, ops []Op, locations []Location, binary *Binary, ...) ([]Op, []Location)
- func AppendApply(numArgs uint8, loc Location, ops []Op, locations []Location) ([]Op, []Location)
- func AppendCall(name string, numArgs uint8, loc Location, ops []Op, locations []Location, ...) ([]Op, []Location)
- func AppendJump(jumpDelta int, conditional bool, loc Location, ops []Op, locations []Location) ([]Op, []Location)
- func AppendLoadConstCharValue(v rune, stack StackKind, loc Location, ops []Op, locations []Location, ...) ([]Op, []Location)
- func AppendLoadConstFloatValue(v float64, stack StackKind, loc Location, ops []Op, locations []Location, ...) ([]Op, []Location)
- func AppendLoadConstIntValue(v int64, stack StackKind, loc Location, ops []Op, locations []Location, ...) ([]Op, []Location)
- func AppendLoadConstStringValue(v string, stack StackKind, loc Location, ops []Op, locations []Location, ...) ([]Op, []Location)
- func AppendLoadConstUnitValue(stack StackKind, loc Location, ops []Op, locations []Location, binary *Binary) ([]Op, []Location)
- func AppendLoadGlobal(ptr Pointer, loc Location, ops []Op, locations []Location) ([]Op, []Location)
- func AppendLoadLocal(name string, loc Location, ops []Op, locations []Location, binary *Binary, ...) ([]Op, []Location)
- func AppendMakeObject(kind ObjectKind, numArgs int, loc Location, ops []Op, locations []Location) ([]Op, []Location)
- func AppendMakePattern(kind PatternKind, name string, numNested uint8, loc Location, ops []Op, ...) ([]Op, []Location)
- func AppendMakePatternLong(kind PatternKind, numNested uint32, loc Location, ops []Op, ...) ([]Op, []Location)
- func AppendSwapPop(loc Location, mode SwapPopMode, ops []Op, locations []Location) ([]Op, []Location)
- func AppendUpdate(field string, loc Location, ops []Op, locations []Location, binary *Binary, ...) ([]Op, []Location)
- type Binary
- type BinaryHash
- type ConstHash
- type ConstHashKind
- type ConstKind
- type FullIdentifier
- type Func
- type Location
- type ObjectKind
- type Op
- type OpKind
- type PackedConst
- type PackedFloat
- type PackedInt
- type PatternKind
- type Pointer
- type QualifiedIdentifier
- type StackKind
- type StringHash
- type SwapPopMode
Constants ¶
View Source
const Version uint32 = 100
Variables ¶
This section is empty.
Functions ¶
func AppendAccess ¶
func AppendApply ¶
func AppendCall ¶
func AppendJump ¶
func AppendLoadConstIntValue ¶
func AppendLoadGlobal ¶
func AppendLoadLocal ¶
func AppendMakeObject ¶
func AppendMakePattern ¶
func AppendMakePattern( kind PatternKind, name string, numNested uint8, loc Location, ops []Op, locations []Location, binary *Binary, hash *BinaryHash, ) ([]Op, []Location)
func AppendMakePatternLong ¶
func AppendSwapPop ¶
func AppendUpdate ¶
Types ¶
type Binary ¶
type Binary struct { CompilerVersion uint32 Funcs []Func Strings []string Consts []PackedConst Exports map[FullIdentifier]Pointer Entry FullIdentifier Packages map[QualifiedIdentifier]uint32 }
type BinaryHash ¶
type BinaryHash struct { FuncsMap map[FullIdentifier]Pointer StringMap map[string]StringHash ConstMap map[PackedConst]ConstHash CompiledPaths []QualifiedIdentifier }
func NewBinaryHash ¶
func NewBinaryHash() *BinaryHash
func (*BinaryHash) HashConst ¶
func (h *BinaryHash) HashConst(v PackedConst, bin *Binary) ConstHash
func (*BinaryHash) HashString ¶
func (h *BinaryHash) HashString(v string, bin *Binary) StringHash
type ConstHashKind ¶
type ConstHashKind uint8
const ( ConstHashKindNone ConstHashKind = iota ConstHashKindInt ConstHashKindFloat )
type ConstKind ¶
type ConstKind uint8
const ( ConstKindUnit ConstKind ConstKindChar ConstKindInt ConstKindFloat ConstKindString )
type FullIdentifier ¶
type FullIdentifier string
type Func ¶
type Func struct { Name StringHash NumArgs uint32 Ops []Op FilePath string Locations []Location }
type ObjectKind ¶
type ObjectKind uint8
const ( ObjectKindList ObjectKind ObjectKindTuple ObjectKindRecord ObjectKindOption )
type OpKind ¶
type OpKind uint32
const ( // OpKindLoadLocal adds named local object to the top of the stack OpKindLoadLocal OpKind // OpKindLoadGlobal adds global object to the top of the stack OpKindLoadGlobal // OpKindLoadConst adds const value object to the top of the stack OpKindLoadConst // OpKindApply executes the function from the top of the stack. // Arguments are taken from the top of the stack in reverse order // (topmost object is the last arg). Returned value is left on the top of the stack. // In case of NumArgs is less than number of function parameters it creates // a closure and leaves it on the top of the stack OpKindApply // OpKindCall executes native function. // Arguments are taken from the top of the stack in reverse order // (topmost object is last arg). Returned value is left on the top of the stack. OpKindCall // OpKindJump moves on delta ops unconditional // conditional jump tries to match pattern with object on the top of the stack. // If it cannot be matched it moves on delta ops // If it matches successfully - locals are extracted from pattern // Matched object is left on the top of the stack in both cases OpKindJump // OpKindMakeObject creates an object on stack. // List items stored on stack in reverse order (topmost object is the last item) // Record fields stored as repeating pairs const string and value (field name is on the top of the stack) // Data stores option name as const string on the top of the stack and // args after that in reverse order (topmost is the last arg) OpKindMakeObject // OpKindMakePattern creates pattern object // Arguments are taken from the top of the stack in reverse order // (topmost object is the last arg). Created object is left on the top of the stack. OpKindMakePattern // OpKindAccess takes record object from the top of the stack and leaves its field on the stack OpKindAccess // OpKindUpdate create new record with replaced field from the top of the stack and rest fields // form the second record object from stack. Created record is left on the top of the stack OpKindUpdate // OpKindSwapPop if pop mode - removes topmost object from the stack // if both mode - removes second object from the top of the stack OpKindSwapPop )
type PackedConst ¶
type PackedConst interface { Pack() uint64 Kind() ConstHashKind Int() int64 Float() float64 }
type PackedFloat ¶
type PackedFloat struct {
Value float64
}
func (PackedFloat) Float ¶
func (c PackedFloat) Float() float64
func (PackedFloat) Int ¶
func (c PackedFloat) Int() int64
func (PackedFloat) Kind ¶
func (c PackedFloat) Kind() ConstHashKind
func (PackedFloat) Pack ¶
func (c PackedFloat) Pack() uint64
type PackedInt ¶
type PackedInt struct {
Value int64
}
func (PackedInt) Kind ¶
func (c PackedInt) Kind() ConstHashKind
type PatternKind ¶
type PatternKind uint8
const ( PatternKindAlias PatternKind PatternKindAny PatternKindCons PatternKindConst PatternKindDataOption PatternKindList PatternKindNamed PatternKindRecord PatternKindTuple )
type QualifiedIdentifier ¶
type QualifiedIdentifier string
type StringHash ¶
type StringHash uint32
Click to show internal directories.
Click to hide internal directories.